linux如何查看nginx啟動路徑
更新時間:2023年07月17日 11:01:35 作者:charles·wang
這篇文章主要介紹了linux如何查看nginx啟動路徑問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
linux查看nginx啟動路徑
由于系統(tǒng)中有多個nginx目錄,不知道哪一個哪一個才是真正的正在運行的服務,記錄查看nginx啟動路徑定位。
查找nginx的pid
[root@wskh xpe]# netstat -anop | grep 0.0.0.0:80 tcp ? ? ? ?0 ? ? ?0 0.0.0.0:80 ? ? ? ? ? ? ?0.0.0.0:* ? ? ? ? ? ? ? LISTEN ? ? ?2320/nginx: master ? off (0.00/0/0)
查找指定pid正在運行服務的啟動路徑
[root@wskh xpe]# ll /proc/2320/exe lrwxrwxrwx 1 root root 0 11月 16 11:29 /proc/2320/exe -> /usr/local/nginx/sbin/nginx
查找nginx啟動使用的配置文件
[root@wskh xpe]# /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
linux nginx啟動、停止、重啟命令
下載安裝
#Install the prerequisites: sudo yum install yum-utils #install nginx sudo yum install nginx
啟動
#使用默認的配置啟動 sudo nginx #指定配置啟動 /etc/nginx/nginx.conf 替換為自己的配置 sudo nginx -c /etc/nginx/nginx.conf #指定錯誤日志路徑 /etc/nginx/error.log 替換為自己的配置 sudo nginx -e /etc/nginx/error.log
停止
#fast shutdown nginx -s stop #優(yōu)雅的關閉? nginx -s quit #查詢啟動的nginx? ps -ax | grep nginx # 強制kill nginx kill -9 ?pid? # 優(yōu)雅 kikk kill -s QUIT pid
重啟
#1. 驗證配置是否正確 nginx -t #2. 加載并應用新的配置 nginx -s reload
總結
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
在 Linux 命令行中使用 tcpdump 抓包的一些功能
tcpdump 是一款靈活、功能強大的抓包工具,能有效地幫助排查網絡故障問題。接下來通過本文給大家介紹在 Linux 命令行中使用 tcpdump 抓包的一些常用功能,需要的朋友參考下吧2018-11-11
Ubuntu18.04VirtualBox安裝中文輸入法實現(xiàn)方式
文章介紹了在虛擬機中安裝中文支持和輸入法的步驟:首先通過圖形界面添加中文語言支持,然后在終端安裝fcitx并重啟虛擬機,最后通過圖形界面安裝具體的輸入法(如拼音),并通過Ctrl+空格切換輸入法2025-10-10

