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

centos 7 配置nginx

时间:2017-08-24 12:34:00      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:arc   ble   访问   pytho   art   ase   mod   nginx配置   nec   

安装nginx:

curl -o  nginx.rpm http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

rpm -ivh nginx.rpm

yum install nginx

 

启动nginx:

systemctl start nginx

激活服务:

systemctl enable nginx 

 

防火墙开放80端口:

firewall-cmd --zone=public --add-port=80/tcp --permanent

systemctl restart firewalld

 

修改nginx配置文件:

vi /etc/nginx/conf.d/default.conf 

内容如下:

server {
    listen 80;
    location / {
        proxy_pass http://localhost:9888;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection keep-alive;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

SELinux白名单:

yum install policycoreutils-python

sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx

sudo semodule -i mynginx.pp

重启nginx:

nginx –s reload

 

浏览器输入:http://192.168.136.138/ ,正常访问9888端口的网站

centos 7 配置nginx

标签:arc   ble   访问   pytho   art   ase   mod   nginx配置   nec   

原文地址:http://www.cnblogs.com/IWings/p/7422133.html

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