centOS7安装Nginx
2017-10-17 11:40
423 查看
一、在线安装
方法/步骤
1.下载对应当前系统版本的nginx包(package)
# wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.建立nginx的yum仓库
# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
3.下载并安装nginx
# yum install nginx
4.启动nginx服务
systemctl start nginx
5.配置
默认的配置文件在 /etc/nginx 路径下,使用该配置已经可以正确地运行nginx;如需要自定义,修改其下的 nginx.conf 和/conf.d/default.conf等文件即可。
如果80端口被占用,在另开一个端口命令如下:
设置centos7的自带防火墙端口号对外部开启
firewall-cmd --zone=public --add-port=8080/tcp --permanent
重启防火墙
systemctl restart firewalld.service
修改配置文件
vi /etc/nginx/conf.d/default.conf
将80端口改为8080端口
退出并保存
重启Nginx服务器
systemctl restart nginx.service
6.测试
在浏览器地址栏中,输入部署nginx环境的机器的IP,如果一切正常,应该能看到如下字样的内容,表示正常。
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
方法/步骤
1.下载对应当前系统版本的nginx包(package)
# wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.建立nginx的yum仓库
# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
3.下载并安装nginx
# yum install nginx
4.启动nginx服务
systemctl start nginx
5.配置
默认的配置文件在 /etc/nginx 路径下,使用该配置已经可以正确地运行nginx;如需要自定义,修改其下的 nginx.conf 和/conf.d/default.conf等文件即可。
如果80端口被占用,在另开一个端口命令如下:
设置centos7的自带防火墙端口号对外部开启
firewall-cmd --zone=public --add-port=8080/tcp --permanent
重启防火墙
systemctl restart firewalld.service
修改配置文件
vi /etc/nginx/conf.d/default.conf
将80端口改为8080端口
退出并保存
重启Nginx服务器
systemctl restart nginx.service
6.测试
在浏览器地址栏中,输入部署nginx环境的机器的IP,如果一切正常,应该能看到如下字样的内容,表示正常。
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
相关文章推荐
- centos7 安装 nginx1.9.2
- centos7安装nginx
- Centos7安装Nginx及配置反向代理和负载均衡
- centos7安装nginx必要环境
- CentOS7安装Nginx
- Centos7安装Nginx
- centos7编译安装nginx1.9.7
- centos7 安装 nginx
- VMware虚拟机中的CentOS7安装Nginx后本机无法访问的解决办法
- 在CentOS7上源码安装最新版的nginx1.11.12
- Centos7安装Nginx
- CentOS7下安装Nginx及配置SSL证书
- CentOS7下载安装Nginx, 详情配置Nginx和对Nginx进行性能优化
- Centos7安装nginx
- centos7 nginx1.10.2编译安装
- centos7 安装nginx和php7
- 【安装zabbix3.4之1-Nginx安装】CentOS7安装Nginx及配置
- Centos7 安装 Nginx
- centos7 安装Nginx
- Centos7通过yum安装nginx