nginx common commands put into shell script details

  • 2021-10-16 05:28:35
  • OfStack

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

2) 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/

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


#!/bin/bash
nginx

4) 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

2) Execute the start. sh script


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

Related articles: