Multiple reverse proxies that read from /static/ ?

kafonek nginx-forum at nginx.us
Thu May 8 19:50:16 UTC 2014


Hello,

Sorry for the beginner question, but I can't seem to find an example
anywhere that shows how to handle nginx hosting more than one reverse proxy
(such as a Django app and an Ipython notebook) where both systems have
static files in different directories.

The relevant parts of my nginx conf look something like this - 

location /django {
    #gunicorn server running on localhost port 8000
    proxy_pass http://127.0.0.1:8000/;
}

location /ipython {
    #ipython notebook server (tornado) running on localhost port 9999
    proxy_pass http://127.0.0.1:9999/;
}

location /static {
    alias /opt/django/django_project/static/;
    #alias /usr/lib/python2.6/site-packages/IPython/html/static/; 
}


Is there a way to specify two different directories of static files or nest
a location /static/ inside the other blocks?  Intuitively nesting doesn't
work, because the css is calling /static, not /ipython/static or
/django/static.

My end goal would be to go to http://mysite.com/django/ to see my Django
pages and http://mysite.com/ipython/ to get to my ipython notebook server. 
Either one works right now if I point location /static {} to the appropriate
alias, but I don't know how to get both working at the same time.

Thanks in advance.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,249943,249943#msg-249943



More information about the nginx mailing list