首页
/
每日頭條
/
科技
/
nginx重啟服務命令
nginx重啟服務命令
更新时间:2026-01-26 15:59:22
啟動

啟動代碼格式:Nginx安裝目錄地址 -c nginx配置文件地址

例如:

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

停止

nginx的停止有三種方式:

  • 從容停止

1、查看進程号

[root@LinuxServer ~]# ps -ef|grep nginx

nginx重啟服務命令(高性能的web服務器Nginx的啟動)1

2、殺死進程

[root@LinuxServer ~]# kill -QUIT 2072

nginx重啟服務命令(高性能的web服務器Nginx的啟動)2

  • 快速停止

1、查看進程号

[root@LinuxServer ~]# ps -ef|grep nginx

nginx重啟服務命令(高性能的web服務器Nginx的啟動)3

2、殺死進程

[root@LinuxServer ~]# kill -TERM 2132 或 [root@LinuxServer ~]# kill -INT 2132

nginx重啟服務命令(高性能的web服務器Nginx的啟動)4

  • 強制停止

[root@LinuxServer ~]# pkill -9 nginx

重啟

1、驗證nginx配置文件是否正确

方法一:進入nginx安裝目錄sbin下,輸入命令./nginx -t

看到如下顯示nginx.conf syntax is ok

nginx.conf test is successful

說明配置文件正确!

nginx重啟服務命令(高性能的web服務器Nginx的啟動)5

方法二:在啟動命令-c前加-t

nginx重啟服務命令(高性能的web服務器Nginx的啟動)6

2、重啟Nginx服務

方法一:進入nginx可執行目錄sbin下,輸入命令./nginx -s reload 即可

nginx重啟服務命令(高性能的web服務器Nginx的啟動)7

方法二:查找當前nginx進程号,然後輸入命令:kill -HUP 進程号 實現重啟nginx服務

nginx重啟服務命令(高性能的web服務器Nginx的啟動)8

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Copyright 2023-2026 - www.tftnews.com All Rights Reserved