2017-05-08 67 views
0

我想用Nginx和Gunicorn在CentOS 7上部署我的Flask應用程序。但是,當使用以下Nginx配置時,我得到「Permission denied」錯誤。在CentOS上代理Gunicorn時,Nginx給出了「權限被拒絕」

server { 
    listen 80; 
    server_name example.org; 
    access_log /var/log/nginx/example.log; 

    location/{ 
     proxy_pass http://127.0.0.1:8000; 
     proxy_set_header Host $host:$server_port; 
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    } 
} 
2017/05/07 18:01:43 [crit] 9470#0: *1 connect() to 127.0.0.1:8000 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.59, server: example.org, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8000/favicon.ico", host: "example.org", referrer: "http://example.org/" 

回答

0

問題是由SELinux的CONFIGRATION引起的,只需禁用selinx會解決這個問題。

# sestatus -v 
SELinux status:     enabled 

# setenforce 0 

# sestatus -v 
SELinux status:     disabled