nginx相关命令

windows系统下: 1,首先Ctrl+R ,输入cmd,进入命令窗口之后切换至nginx所在目录下

(1)启动nginx,start nginx;

(2)关闭nginx,nginx -s stop;

(3)重启nginx,nginx -x reload

linux系统下:

    (1)检查配置文件是否正确 :

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

    (2)启动nginx:

[root@localhost ~]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

            或者 直接检查 配置文件 并启动:

/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf

    (3)查看nginx进程:

[root@localhost tmp]# ps -ef|grep nginx
root      1877     1  0 18:02 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody    1878  1877  0 18:02 ?        00:00:01 nginx: worker process
root     11859  1855  0 21:17 pts/0    00:00:00 grep nginx

    (4)关闭nginx进程:

kill -9 1877
kill -9 1878

    (5)重启nginx:

/usr/local/nginx/sbin/nginx  -s reload

你可能感兴趣的:(nginx)