Put common nginx commands into shell scripts

1. Create a folder to store nginx shell scripts

 /usr/local/task/nginx

1) Restart the nginx shell script
vim reload.sh

#!/bin/bash

nginx -s reload

2) A shell script
vim setfacl.sh that sets the read, write, and execute permissions for all files in the html directory for the nginx user

#!/bin/bash

setfacl -m u:nginx:rwx -R /usr/local/nginx/html/

setfacl -m d:u:nginx:rwx -R /usr/local/nginx/html/

3) The shell script
vim start.sh to start the nginx process

#!/bin/bash

nginx

4) The shell script
vim stop.sh to stop the nginx process

#!/bin/bash

nginx -s stop

2. Use

1) Add execution permissions to nginx shell file scripts

chmod -R 755  /usr/local/task/nginx

2) Execute the start.sh script

/usr/local/task/nginx/start.sh

Guess you like

Origin blog.csdn.net/weixin_39218464/article/details/114061366