Home >Operation and Maintenance >Nginx >What are the methods to restart nginx?
View process
(Recommended tutorial: nginx tutorial)
ps -ef|grep nginx
Smooth restart command:
kill -HUP 主进程号或进程号文件路径
Or use
/usr/nginx/sbin/nginx -s reload
Note that after modifying the configuration file, it is best to check whether the modified configuration file is correct to avoid Nginx errors after restarting, which will affect the stable operation of the server.
The command to determine whether the Nginx configuration is correct is as follows:
nginx -t -c /usr/nginx/conf/nginx.conf
or
/usr/nginx/sbin/nginx -t
nginx reload restart
execute
# /usr/local/nginx/sbin/nginx -s reload
nginx has been restarted successfully
Centos nginx restart
Restart Nginx
service nginx restart /etc/init.d/nginx stop /etc/init.d/nginx start
Ubuntu Nginx
$sudo service nginx start $sudo service nginx stop
win7
Start
Extract to c:\nginx and run nginx.exe (i.e. nginx -c conf\nginx.conf). By default, port 80 is used. For logs, see the folder C:\nginx\logs
Common configuration
C:\nginx\conf\nginx.conf, use your own defined conf file such as my.conf, the command is nginx -c conf\my.conf
The above is the detailed content of What are the methods to restart nginx?. For more information, please follow other related articles on the PHP Chinese website!