天天看點

centos 查找nginx_查找nginx安裝的路徑以及相關安裝操作指令

1、檢視nginx安裝目錄

輸入指令

# ps  -ef | grep nginx

傳回結果包含安裝目錄

root     2662    1 0 07:12 ?       00:00:00 nginx: master process /usr/sbin/nginx

2、檢視nginx.conf配置檔案目錄

輸入指令

# nginx -t

傳回結果包含配置檔案目錄

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

3、啟動nginx服務

[[email protected] ~]# nginx安裝目錄 -c nginx.conf配置檔案目錄

參數 “-c” 指定了配置檔案的路徑,如果不加 “-c” 參數,Nginx 會預設加載其安裝目錄的 conf 子目錄中的 nginx.conf 檔案。

查找nginx安裝的路徑以及相關安裝操作指令

Linux環境下,怎麼确定Nginx是以那個config檔案啟動的?

[[email protected] ~]# ps -ef | grep nginx

root 21196 1 0 23:40 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

nginx 21197 21196 0 23:40 ? 00:00:00 nginx: worker process

root 21199 20993 0 23:42 pts/0 00:00:00 grep --color=auto nginx