CentOS 6.9/7通过yum安装指定版本的Nginx

文章目录

[隐藏]

  • 一、安装和配置

说明:通过yum好处其实很多,环境变量不用配置,配置文件放在大家都熟悉的地方,通过rpm -ql nginx可以知道全部文件的地方等等。

Nginx(1.12.2)

一、安装和配置

1、安装

# rpm -ivh http://nginx.org/packages/centos/6/x86_64/RPMS/nginx-1.12.2-1.el6.ngx.x86_64.rpm  

备注:其实根据上面这个网址(http://nginx.org/packages/)可以进去其nginx官方的的包管理列表,选择合适的系统和包

2、启动

# nginx  // 验证是否启动成功  # curl http://127.0.0.1:80  // 正常会返回html代码  

3、设置开机启动服务

# chkconfig nginx on  

4、服务常用操作

// 服务状态  # service nginx status  // 服务启动  # service nginx start  // 服务停止  # service nginx stop  // 服务重启  # service nginx restart  

CentOS 7:

1、安装

# rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.12.2-1.el7_4.ngx.x86_64.rpm  

2、启动

# systemctl start nginx  // 验证是否启动成功  # curl http://127.0.0.1:80  // 正常会返回html代码  

3、设置开机启动服务

# systemctl enable nginx  

4、服务常用操作

// 服务状态  # systemctl status nginx  // 服务启动  # systemctl start nginx  // 服务停止  # systemctl stop nginx  // 服务重启  # systemctl restart nginx  

原文出处:cnblogs -> http://www.cnblogs.com/EasonJim/p/9020896.html

本站所发布的一切资源仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如果侵犯你的利益,请发送邮箱到 [email protected],我们会很快的为您处理。