简体   繁体   中英

Timeout error with nginx and Django app using uWSGI

I have a problem with a Django application; I'm trying to set up a deployment server but I am getting a timeout error. I am running uWSGI:

uwsgi --http :8000 --chdir /home/rrcms/myproject/ --wsgi-file /home/rrcms/myproject/quickstart/wsgi.py

and when I go to www.mydomain.com:8000 I can see the site running but when I try to configure nginx on port 80 to make it communicate with uWSGI I get a 504 Gateway Time-out, here's my nginx sites-available file:

upstream django {
    server 127.0.0.1:8000; 
}


server {
    listen      80;
    server_name www.mydomain.com; 
    charset     utf-8;

    # max upload size
    client_max_body_size 75M; 

    location /static {
        alias /home/rrcms/myproject/static; 
    }


    location / {
        uwsgi_pass  django;
        include     /home/rrcms/myproject/uwsgi_params; 
    }
}

I'm running out of ideas on what might be happening.

I found the problem. The issue was that I was trying to use uwsgi --http :8000 but what I needed to use was a socket so I just changed

uwsgi --socket :8000 --chdir /home/rrcms/myproject/ --wsgi-file /home/rrcms/myproject/quickstart/wsgi.py

and it works fine now.

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