简体   繁体   中英

502 Bad Gateway:[nginx/1.4.7]

I am configuring django (1.6.5) project with gunicorn and nginx server.Project successfully working with django basic server python manage.py runserver .And later i bind an address with gunicorn as gunicorn myproject.wsgi:application --bind=127.0.0.1:8001 .And configured in nginx.conf file at /etc/nginx/nginx.conf .When i restarted nginx server and given request in browser as localhost:8080 i am getting 502 Bad Gateway .What is the mistake i am doing

Here is my nginx.conf code

server {
listen 8080;
server_name localhost;
access_log  /var/log/nginx/example.log;

location / {
    proxy_pass http://127.0.0.1:8001;
    }
  } 

Updated:

In the error log file: error_log /var/log/nginx/example.error.log;

i am getting the following;

2014/05/29 13:13:08 [crit] 6701#0: *1 connect() to 0.0.0.0:8001 failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://0.0.0.0:8001/", host: "localhost:8080"

Any help would be appreciated.

I have overcome the above problem by placing my current fedora working user name as nginx working user.I have find the user at the top of my nginx.conf file in the /etc/nginx directory.I am currently working as user in linux environment, and replaced the user name nginx with user in the nginx.conf file. That's it my problem solved.

显然期望在8001上使用HTTP(不是WSGI)处理程序。您可以在此处阅读有关Nginx WSGI配置的更多信息: http : //uwsgi-docs.readthedocs.org/en/latest/Nginx.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM