在CentOS 6上安装最新稳定版的Nginx(通过官方仓库)

首先

使用公式的软件仓库在CentOS6上安装最新的稳定版Nginx
参考:Nginx的各种安装方法和EOL总结

支持

我认为,如果采用本方法进行引入,将会得到支持,直到nginx的开发停止。
如果不指定特定版本,应该会提供最新的稳定版。

日志

提交仓库

# vi /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[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

安装

# cat /etc/redhat-release
CentOS release 6.10 (Final)

# yum install -y nginx
... 略

启动/停止nginx

# service nginx start
Starting nginx:                                            [  OK  ]

# service nginx status
nginx (pid 107) is running...
# service nginx stop
Stopping nginx:                                            [  OK  ]

# service nginx status
nginx is stopped

自動启动/取消设置nginx

# chkconfig nginx on

# chkconfig --list nginx
nginx           0:off   1:off   2:on    3:on    4:on    5:on    6:off
# chkconfig nginx off

# chkconfig --list nginx
nginx           0:off   1:off   2:off   3:off   4:off   5:off   6:off

确定的各种事务

# which nginx
/usr/sbin/nginx

# nginx -v
nginx version: nginx/1.16.1

# yum info nginx
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Installed Packages
Name        : nginx
Arch        : x86_64
Version     : 1.16.1
Release     : 1.el6.ngx
Size        : 2.6 M
Repo        : installed
From repo   : nginx-stable
Summary     : High performance web server
URL         : http://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.
广告
将在 10 秒后关闭
bannerAds