Mulagala
Mulagala

Reputation: 8661

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.

Upvotes: 0

Views: 1111

Answers (2)

Mulagala
Mulagala

Reputation: 8661

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.

Upvotes: 1

vdudouyt
vdudouyt

Reputation: 936

It's apparently expecting a HTTP (not WSGI) handler on 8001. You can read more about Nginx WSGI configuration here: http://uwsgi-docs.readthedocs.org/en/latest/Nginx.html

Upvotes: 0

Related Questions