码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS7 - 安装Nginx

时间:2018-02-14 00:17:51      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:package   lease   class   with   ref   退出   follow   block   lin   

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

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “6” or “7”, for 6.x or 7.x versions, respectively.

  • 安装Nginx
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# vim nginx.repo
[root@localhost yum.repos.d]# vim nginx.repo 
# nginx.repo
# 需要对上面的源信息进行更改 OS=>centos   OSRELEASE=>7
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
# 保存退出

# 列出Nginx相关
[root@localhost yum.repos.d]# yum list | grep nginx
# 安装Nginx
[root@localhost yum.repos.d]# yum install nginx
# 查看Nginx版本信息 (小写v)
[root@localhost yum.repos.d]# nginx -v
# 查看Nginx相关参数信息 (大写V)
[root@localhost yum.repos.d]# nginx -V
# 启动Nginx
[root@localhost yum.repos.d]# service nginx start
# 停止Nginx
[root@localhost yum.repos.d]# service nginx stop
# 重启Nginx
[root@localhost yum.repos.d]# service nginx restart
# 重载Nginx配置,平滑重启
[root@localhost yum.repos.d]# service nginx reload  

CentOS7 - 安装Nginx

标签:package   lease   class   with   ref   退出   follow   block   lin   

原文地址:https://www.cnblogs.com/zpsong/p/8447661.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!