What are the methods to restart nginx?

王林
Release: 2020-10-29 15:30:39
forward
6025 people have browsed it

What are the methods to restart nginx?

View process

(Recommended tutorial: nginx tutorial)

ps -ef|grep nginx
Copy after login

Smooth restart command:

kill -HUP 主进程号或进程号文件路径
Copy after login

Or use

/usr/nginx/sbin/nginx -s reload
Copy after login

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
Copy after login

or

/usr/nginx/sbin/nginx -t
Copy after login

nginx reload restart

execute

# /usr/local/nginx/sbin/nginx -s reload
Copy after login

nginx has been restarted successfully

Centos nginx restart

Restart Nginx

service nginx restart
/etc/init.d/nginx stop
/etc/init.d/nginx start
Copy after login

Ubuntu Nginx

$sudo service nginx start
$sudo service nginx stop
Copy after login

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!

Related labels:
source:csdn.net
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