共 1 篇文章

标签:Linux nginx 重启 启动 停止

详解Linux中nginx如何重启、启动与停止-国外主机测评 - 国外VPS,国外服务器,国外云服务器,测评及优惠码

详解Linux中nginx如何重启、启动与停止

详解Linux中nginx如何重启、启动与停止  更新时间:2023年12月07日 11:49:32   作者:乞力马扎罗の黎明   这篇文章主要给大家详细介绍了Linux中nginx如何重启、启动与停止/设置开机自启动,小编觉得挺不错的,现在分享给大家,也给大家做个参考,一起跟随小编过来看看吧<BR> 目录 一、启动/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 二、停止 1、从容停止 2、快速停止 3、强制停止: pkill -9 nginx 三、重启 1、验证nginx配置文件是否正确 2、重启nginx服务 一、启动/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 启动代码格式:nginx安装目录地址 -c nginx配置文件地址 例如: [root@localhost ~]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 二、停止 nginx的停止有三种方式: 1、从容停止 (1)查看进程号: ps -ef|grep nginx [root@localhost ~]# ps -ef|grep nginx (2)杀死进程: kill -quit xxxx 142804是进程的编号 [root@localhost ~]# kill -quit 142804 2、快速停止 (1)查看进程号: ps -ef|grep nginx [root@localhost ~]# ps -ef|grep nginx (2)杀死进程:  kill -term xxxx/ kill -int xxxx 142804是进程的编号 [root@localhost ~]# kill -term 142804 或   [root@localhost ~]# kill -int 142804 3、强制停止: pkill -9 nginx [root@localhost ~]# pkill -9 nginx 三、重启 1、验证nginx配置文件是否正确 (1)方法一:进入nginx安装目录sbin下,输入命令./nginx -t 看到如下显示nginx.conf syntax is ok nginx.conf test is successful 说明配置文件正确! [root@localhost ~]# cd /usr/local/nginx/sbin [root@localhost sbin]# ./nginx -t (2)方法二:在启动命令-c前加-t [root@localhost sbin]# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf 2、重启nginx服务...

技术分享