【nginx】linux(centos6)下安裝nginx(一)

 

官網給出了詳細的不同安裝方式的安裝步驟(安裝地址:http://nginx.org/en/linux_packages.html#RHEL-CentOS),本文采用centos安裝。

 

按照其中的步驟信手拈來即可,下面步驟來自官網,紅字爲翻譯

Install the prerequisites: 【安裝先決條件,此處安裝yum-utils工具包】

sudo yum install yum-utils

To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

【設置yum倉庫源,此處爲nginx的倉庫源,在/etc/yum.repos.d/下創建名爲nginx.repo的文件,並在該文件中做如下源配置

[nginx-stable]   #倉庫id
name=nginx stable repo #倉庫名字
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/  #倉庫的地址
gpgcheck=1  #是否使用密鑰驗證,1開啓,0不開啓
enabled=1  #是否開啓當前倉庫, 1開啓,0不開啓
gpgkey=https://nginx.org/keys/nginx_signing.key  #公鑰地址,若是需要檢查完整性的話可以添加密鑰地址
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:

【默認情況下,會使用倉庫中的nginx穩定版。如果你想使用最新主流的nginx版本,可運行下面的命令】

sudo yum-config-manager --enable nginx-mainline

To install nginx, run the following command:

【運行下面的命令安裝nginx】

sudo yum install nginx

When prompted to accept the GPG key, verify that the fingerprint matches 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62, and if so, accept it.

【當有提示是否接受GPGkey時,接受它即可】

至此,軟件安裝結束。應該會出現下面提示:


Installed:
  nginx.x86_64 0:1.17.9-1.el6.ngx                                                                                                      

Complete!

那麼如何查看nginx的安裝目錄在哪?使用下面的命令

rpm -ql nginx


[root@apollo-test yum.repos.d]# rpm -ql nginx
/etc/logrotate.d/nginx
/etc/nginx
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/nginx/fastcgi_params
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/modules
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf
/etc/rc.d/init.d/nginx
/etc/rc.d/init.d/nginx-debug
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
/usr/lib64/nginx
/usr/lib64/nginx/modules
/usr/sbin/nginx
/usr/sbin/nginx-debug
/usr/share/doc/nginx-1.17.9
/usr/share/doc/nginx-1.17.9/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
/usr/share/nginx
/usr/share/nginx/html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html
/var/cache/nginx
/var/log/nginx

 

 

yum命令介紹參考:https://blog.csdn.net/coolcoffee168/article/details/105476318

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章