I'm trying to serve a Django application to production. I have installed Gunicorn and now I need to setup a Nginx Virtual Host. I'm kind of lost on how to configure the "virtual.conf" from Nginx. I just want to use Nginx as proxy, I don't want to configure deplyment scripts for now.

I have this layout taken from here(http://senko.net/en/django-nginx-gunicorn/):

server {
    listen   80;
    server_name example.com;
    # no security problem here, since / is alway passed to upstream
    root /path/to/test/hello;
    # serve directly - analogous for static/staticfiles
    location /media/ {
    # if asset versioning is used
    if ($query_string) {
        expires max;
    }
    }
    location /admin/media/ {
    # this changes depending on your python version
    root /path/to/test/lib/python2.6/site-packages/django/contrib;
    }
    location / {
    proxy_pass_header Server;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_connect_timeout 10;
    proxy_read_timeout 10;
    proxy_pass http://localhost:8000/;
    }
    # what to serve if upstream is not available or crashes
    error_page 500 502 503 504 /media/50x.html;
}

To put things working I should replace:

root /path/to/test/hello;

For the path where I have my Django Project?

I have Django and all other Python scripts installed in a virtualenv.

Can someone give me some gidelines to get Django working with Gunicorn with Nginx as proxy?

Best Regards,

link|improve this question

62% accept rate
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.