Liunx查找nginx應(yīng)用安裝的路徑以安裝nginx操作命令

查找nginx安裝的路徑以及相關(guān)安裝操作命令

Linux環(huán)境下,怎么確定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


檢查是否已經(jīng)安裝有nginx及對應(yīng)目錄:

[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
然后看到一行記錄,復(fù)制最后的一個數(shù)據(jù)(進程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


查看服務(wù)器上安裝的nginx版本號,主要是通過ngix的-v或-V選項
Linux下查看Nginx安裝目錄、版本號信息?
-v 顯示 nginx 的版本。
-V 顯示 nginx 的版本,編譯器版本和配置參數(shù)。

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

nginx version: nginx/1.8.0

===================================
查看linux系統(tǒng)版本命令

[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系統(tǒng)庫中默認(rèn)是沒有nginx的rpm包的,所以我們自己需要先更新下rpm依賴庫
(1)使用yum安裝nginx需要包括Nginx的庫,安裝Nginx的庫

rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

rpm包的安裝:
1.安裝一個包

# rpm -ivh

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

# rpm -Uvh

3.移走一個包

# rpm -e

安裝準(zhǔn)備依賴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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容