Detailed explanation of putting common nginx commands into shell scripts

Detailed explanation of putting common nginx commands into shell scripts

1. Create a folder to store nginx shell scripts

 /usr/local/task/nginx

1) Restart nginx shell script
vim reload.sh

#!/bin/bash
nginx -s reload

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

#!/bin/bash
setfacl -mu:nginx:rwx -R /usr/local/nginx/html/
setfacl -md:u:nginx:rwx -R /usr/local/nginx/html/

3) Shell script to start the nginx process
vim start.sh

#!/bin/bash
nginx

4) Shell script to stop nginx process
vim stop.sh

#!/bin/bash
nginx -s stop

2. Use

1) Add execution permissions to the nginx shell script

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

2) Execute the start.sh script

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

This is the end of this article about the detailed explanation of putting commonly used nginx commands into shell scripts. For more relevant content about putting nginx commands into shell scripts, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed process of installing nginx with shell script source code
  • Shell script nginx automation script
  • How to install nginx under Linux
  • Example of implementing nginx self-starting script under centos/rhel
  • Shell script to install Nginx service and customize Nginx version in one click

<<:  MySQL implements string concatenation, interception, replacement, and position search operations

>>:  Vue implements the digital thousands separator format globally

Recommend

How to read the regional information of IP using Nginx and GeoIP module

Install GeoIP on Linux yum install nginx-module-g...

Detailed tutorial on installing mysql 8.0.20 on CentOS7.8

1. Install MySQL software Download and install My...

Summary of the understanding of virtual DOM in Vue

It is essentially a common js object used to desc...

Mysql8.0 uses window functions to solve sorting problems

Introduction to MySQL Window Functions MySQL has ...

Solution to the problem of not finding Tomcat configuration in Intelli Idea

I joined a new company these two days. The compan...

How to install MySQL 5.7.29 with one click using shell script

This article refers to the work of 51CTO blog aut...

Records of using ssh commands on Windows 8

1. Open the virtual machine and git bash window a...

Summary of horizontal scrolling website design

Horizontal scrolling isn’t appropriate in all situ...

Solve the problem of using swiper plug-in in vue

Since I used this plugin when writing a demo and ...

How to use the VS2022 remote debugging tool

Sometimes you need to debug remotely in a server ...

404 error occurs when accessing the homepage of tomcat started in Docker mode

Scenario: When starting tomcat in docker (version...

Implementation of MySQL master-slave status check

1. Check the synchronization status of A and B da...