在不同的linux系统中,安装nginx之后,要启动nginx,目录路径可能有一点不一样,如下是Ubantu系统启动nginx。
1.查看进程号
ps -ef|grep nginx
结果:14540便是
pi 8412 9330 0 13:51 pts/1 00:00:00 grep --color=auto nginx root 14540 1 0 13:28 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; www-data 14541 14540 0 13:28 ? 00:00:00 nginx: worker process www-data 14542 14540 0 13:28 ? 00:00:00 nginx: worker process www-data 14543 14540 0 13:28 ? 00:00:00 nginx: worker process www-data 14544 14540 0 13:28 ? 00:00:00 nginx: worker process
2.杀死进程
sudo kill -QUIT 14540
3.重启nginx
首先要找到sbin目录,我的在/usr/sbin这里
cd /usr/sbin/
sudo ./nginx -t
看结果:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
这样就成功了!
原文:https://www.cnblogs.com/aaronthon/p/9946106.html