【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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值