Multiple reverse proxies that read from /static/ ?

Matt Gray matt.gray at 7digital.com
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  - notebook.mysite.com or
similiar. If you really want to try the "merge" approach, try_files
http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files might be
of use.


On 8 May 2014 20:50, kafonek <nginx-forum at nginx.us> 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 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
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



-- 
*Matt Gray*
API Developer

*T:* +44(0)207 099 7777
*E:* matt.gray at 7digital.com
*W:* www.7digital.com<http://www.google.com/url?q=http%3A%2F%2Fwww.7digital.com&sa=D&sntz=1&usg=AFrqEzeLlO75mVeA-8Yi-niLjEpFokXaYA>

-- 


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 
prohibited.

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: <http://mailman.nginx.org/pipermail/nginx/attachments/20140509/ed52597d/attachment-0001.html>


More information about the nginx mailing list