前序:
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