nginx common commands put into shell script details


1. Create a folder to store shell scripts for nginx

 /usr/local/task/nginx
  1. Restart the shell script for nginx vim reload.sh
#!/bin/bash
nginx -s reload
  1. The shell script that sets the nginx user’s permission to read and write all files in the html directory vim setfacl.sh
#!/bin/bash
setfacl -m u:nginx:rwx -R /usr/local/nginx/html/
setfacl -m d:u:nginx:rwx -R /usr/local/nginx/html/
  1. The shell script to start the nginx process vim start.sh
#!/bin/bash
nginx
  1. Stop the shell script of the nginx process vim stop.sh
#!/bin/bash
nginx -s stop

2. Use

  1. Add execution permission to shell file script of nginx
chmod -R 755 /usr/local/task/nginx
  1. Execute the start. sh script
/usr/local/task/nginx/start.sh