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

Implementation of vite+vue3.0+ts+element-plus to quickly build a project

Table of contents vite function Use Environment B...

5 super useful open source Docker tools highly recommended

Introduction The Docker community has created man...

Implementation of Docker private warehouse registry deployment

As more and more Docker images are used, there ne...

Explanation of the precautions for Mysql master-slave replication

1. Error error connecting to master 'x@xxxx:x...

Tips for viewing text in Linux (super practical!)

Preface In daily development, we often need to pe...

MySQL uses the Partition function to implement horizontal partitioning strategy

Table of contents 1 Review 2 Five strategies for ...

How to modify the root user password in mysql 8.0.16 winx64 and Linux

Please handle basic operations such as connecting...

Tutorial on using Webpack in JavaScript

Table of contents 0. What is Webpack 1. Use of We...

Summary of Textarea line break issues in HTML

Recently, I encountered a problem of whether the d...

Vue conditional rendering v-if and v-show

Table of contents 1. v-if 2. Use v-if on <temp...

A brief discussion on the use of GROUP BY and HAVING in SQL statements

Before introducing the GROUP BY and HAVING clause...

MySQL 8.0.13 installation and configuration tutorial under CentOS7.3

1. Basic Environment 1. Operating system: CentOS ...

Vue realizes the product magnifying glass effect

This article example shares the specific code of ...