查詢nginx安裝的路徑以及相關安裝操作命令

2021-10-09 09:02:14 字數 2962 閱讀 4047

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服務

[root@localhost ~]# nginx安裝目錄 -c nginx.conf配置檔案目錄

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

查詢nginx安裝的路徑以及相關安裝操作命令

linux環境下,怎麼確定nginx是以那個config檔案啟動的? 

[root@localhost ~]# 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

------------------------------------

檢查是否已經安裝有nginx及對應目錄:

[root@localhost ~]# find /|grep nginx.conf

/etc/nginx/conf.d

/etc/nginx/conf.d/example_ssl.conf

/etc/nginx/conf.d/default.conf

/etc/nginx/nginx.conf

----------------------------------

還可以用以下兩個命令,找安裝的路徑

[root@localhost ~]# netstat -tnlp|grep nginx

tcp 0 0 0.0.0.0:80 0.0.0.0:* listen 21196/nginx: master

然後看到一行記錄,複製最後的乙個資料(程序id)

ps -aux |grep 程序id

就可以看到nginx的啟動方式了。

[root@localhost ~]# ps -aux |grep 21196

root 21196 0.0 0.0 48044 924 ? ss 23:40 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

root 21204 0.0 0.2 112648 2320 pts/0 s+ 23:45 0:00 grep --color=auto 21196

--------------------------------

檢視伺服器上安裝的nginx版本號,主要是通過ngix的-v或-v選項

linux下檢視nginx安裝目錄、版本號資訊?

-v 顯示 nginx 的版本。

-v 顯示 nginx 的版本,編譯器版本和配置引數。

[root@localhost ~]# /usr/sbin/nginx -v

nginx version: nginx/1.8.0

***********************************

檢視linux系統版本命令

[root@localhost ~]# cat /proc/version

linux version 4.1.5-x86_64-linode61 (maker@build) (gcc version 4.7.2 (debian 4.7.2-5) ) #7 smp mon aug 24 13:46:31 edt 2015

[root@localhost ~]# cat /etc/redhat-release

centos linux release 7.0.1406 (core)

***********************************

ubuntu下安裝nginx,直接apt-get install nginx就行了

centos 下安裝nginx:

centos7系統庫中預設是沒有nginx的rpm包的,所以我們自己需要先更新下rpm依賴庫

(1)使用yum安裝nginx需要包括nginx的庫,安裝nginx的庫

rpm -ivh

rpm包的安裝:

1.安裝乙個包

# rpm -ivh

2.公升級乙個包,沒安裝過的不能使用公升級命令

# rpm -uvh

3.移走乙個包

# rpm -e

安裝準備依賴lib庫

yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

(2)使用下面命令安裝nginx

#yum install nginx

(3)啟動nginx

#service nginx start

或#systemctl start nginx.service

(4)重啟nginx

service nginx restart

Nginx 安裝以及配置

nginx ngine x,是一款自由的 開源的 高效能http伺服器和反向 伺服器 也是乙個imap pop3 smtp 伺服器 也就是說nginx本身就可以託管 類似於tomcat一樣 進行http服務處理,也可以作為反向 伺服器使用。其實最直接的用處就是作為負載均衡器,雖然目前nginx的份額...

Nginx的安裝以及基本使用

nginx一般推薦安裝到linux系統,而且要安裝c語言的編譯環境gcc。安裝nginx依賴的包 注意 上邊將臨時檔案目錄指定為 var temp nginx,需要在 var下建立temp及nginx目錄 第四步 make 第五步 makeinstall 啟動 進入nginx的sbin目錄,ngin...

windows安裝以及配置nginx

2 解壓到相應的目錄 3 進入nginx目錄 雙擊nginx.exe 來啟動nginx,雙擊 exe檔案,一閃而過,此時想要確定是否啟動成功,可以直接開啟任務管理器檢視 4 訪問預設頁面 nginx啟動後,在瀏覽器中訪問http localhost,可以看到預設的歡迎頁面 5.配置nginx 配置專...