Home > Operation and Maintenance > Nginx > How to restart nginx after modifying the configuration file

How to restart nginx after modifying the configuration file

藏色散人
Release: 2019-08-19 10:58:31
Original
13008 people have browsed it

How to restart nginx after modifying the configuration file

How to restart nginx after modifying the configuration file?

Step 1: nginx is often used in conjunction with tomcat. The policy configuration files of nginx are basically in nginx.conf. First log in to the Linux server and check whether we have installed the nginx service. Use nginx -V as shown in the figure. The command can check the nginx version we installed

How to restart nginx after modifying the configuration file

##Step 2: Enter the nginx configuration directory /etc/nginx/, nginx.conf in the directory is the nginx configuration file

How to restart nginx after modifying the configuration file

Step 3: Modify the port configured in nginx.conf. If you see that the current port used by nginx.con is 80

vi nginx.conf view

How to restart nginx after modifying the configuration file

Step 4: Modify the nginx.conf file, change the port to 8080, and then save it

How to restart nginx after modifying the configuration file

Step 5: After modifying the file, use nginx -t tests whether the modified syntax of the configuration file is correct (an error will be reported if there is any problem)

How to restart nginx after modifying the configuration file

Step 6: Use the nginx -s reload command to restart to make the configuration file take effect

The reload command will reload the configuration file and the nginx service will not be interrupted. As shown in the figure, the service restarts normally and the listening port has been modified to 8080

How to restart nginx after modifying the configuration file

More Nginx related For technical articles, please visit the

Nginx Tutorial column to learn!

The above is the detailed content of How to restart nginx after modifying the configuration file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template