Nginx常用命令

检查nginx配置文件是否有语法错误

[root@localhost conf]# /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

[root@localhost sbin]# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
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

重新加载nginx配置文件使其生效

[root@localhost conf]# /usr/local/nginx/sbin/nginx  -s  reload

启动nginx

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

查看nginx进程

[root@localhost sbin]# ps -ef | grep nginx
root       3256      1  0 07:27 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nginx      3259   3256  0 07:28 ?        00:00:00 nginx: worker process
nginx      6002   3268  0 08:08 ?        00:00:15 php-fpm: pool www
nginx      6180   3268  0 08:23 ?        00:00:12 php-fpm: pool www
nginx      6359   3268  0 08:38 ?        00:00:09 php-fpm: pool www
root       7755   7332  0 09:19 pts/1    00:00:00 grep --color=auto nginx
[root@localhost sbin]# ps -aux | grep nginx
root       3256  0.0  0.1  45316  1892 ?        Ss   07:27   0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nginx      3259  0.0  0.2  45664  2332 ?        S    07:28   0:00 nginx: worker process
nginx      6002  0.3  1.8 332724 18480 ?        S    08:08   0:15 php-fpm: pool www
nginx      6180  0.3  1.6 330208 16060 ?        S    08:23   0:12 php-fpm: pool www
nginx      6359  0.3  2.0 335076 20948 ?        S    08:38   0:09 php-fpm: pool www
root       7757  0.0  0.0 112648   960 pts/1    R+   09:19   0:00 grep --color=auto nginx

停止nginx服务

[root@localhost sbin]# /usr/local/nginx/sbin/nginx -s stop
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值