Multiple reverse proxies that read from /static/ ?

Matt Gray matt.gray at
Fri May 9 10:23:53 UTC 2014

I think your comment "intuitively nesting doesn't work" is correct - you
wish to merge the uri spaces of django and ipython into one, which means
that if both apps need (eg) /static/css/main.css, they will collide and one
app will always get the wrong file. It might be that you can avoid
collisions of this type by chance, but then you run the risk of collision
occurring due to an upgrade of either app.

I would either a) see if you can modify the static files location for the
apps, or serve one / both off a subdomain  - or
similiar. If you really want to try the "merge" approach, try_files might be
of use.

On 8 May 2014 20:50, kafonek <nginx-forum at> wrote:

> 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;
> }
> location /ipython {
>     #ipython notebook server (tornado) running on localhost port 9999
>     proxy_pass;
> }
> 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 to see my Django
> pages and 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:
> _______________________________________________
> nginx mailing list
> nginx at

*Matt Gray*
API Developer

*T:* +44(0)207 099 7777
*E:* matt.gray at


This email, including attachments, is private and confidential. If you have 
received this email in error please notify the sender and delete it from 
your system. Emails are not secure and may contain viruses. No liability 
can be accepted for viruses that might be transferred by this email or any 
attachment. Any unauthorised copying of this message or unauthorised 
distribution and publication of the information contained herein are 

7digital Limited. Registered office: 69 Wilson Street, London EC2A 2BB.
Registered in England and Wales. Registered No. 04843573.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list