前序:
Nginx從入門到實戰(一):介紹
Nginx從入門到實戰(二):Linux安裝Nginx
Nginx常用命令
1.查看版本號
[root@localhost sbin]# ./nginx -v
nginx version: nginx/1.12.2
2.啓動nginx
[root@localhost sbin]# ./nginx
[root@localhost sbin]# ps -ef | grep nginx
root 17340 1 0 13:10 ? 00:00:00 nginx: master process ./nginx
nobody 17341 17340 0 13:10 ? 00:00:00 nginx: worker process
root 17343 13527 0 13:10 pts/0 00:00:00 grep --color=auto nginx
3.關閉nginx
[root@localhost sbin]# ./nginx -s stop
[root@localhost sbin]# ps -ef | grep nginx
root 17330 13527 0 13:10 pts/0 00:00:00 grep --color=auto nginx
4.重新加載nginx(修改配置文件重新加載)
[root@localhost sbin]# ./nginx -s reload
[root@localhost sbin]# ps -ef | grep nginx
root 17340 1 0 13:10 ? 00:00:00 nginx: master process ./nginx
nobody 17358 17340 0 13:12 ? 00:00:00 nginx: worker process
root 17360 13527 0 13:12 pts/0 00:00:00 grep --color=auto nginx