
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

##Step 2: Enter the nginx configuration directory /etc/nginx/, nginx.conf in the directory is the nginx 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

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

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)

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

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!