[BangPypers] Multiple Django app with nginx

Sathishkumar Duraisamy bewithsathish at gmail.com
Thu May 19 13:31:34 EDT 2016


On Thu, May 19, 2016 at 9:27 AM, Saurabh Kumar <thes.kumar at gmail.com> wrote:

> On Thu, May 19, 2016 at 12:41 AM, Sathishkumar Duraisamy <
> bewithsathish at gmail.com> wrote:
>
> > Hi All,
> >
> > In Apache with help of modwsgi module we can mount may application like
> >
> >  WSGIScriptAlias /app1 /usr/local/www/wsgi-scripts/myapp1.wsgi
> >  WSGIScriptAlias /app2 /usr/local/www/wsgi-scripts/myapp2.wsgi
> >
> > What is the similar approch for NGINX  web server? Any idea?
> >
> > I have been trying with reverse proxy along with gunicorn, but not able
> to
> > achieve.
> >
> > I am trying to get mount as follows:
> >
> > http://exmaple.com/app1 --> 127.0.0.1:8000/
> > http://exmaple.com/app1/home/ --> 127.0.0.1:8000/home/
> >
> >
> > http://exmaple.com/app2 --> 127.0.0.1:9000/
> > http://exmaple.com/app2/home/ --> 127.0.0.1:9000/home/
> >
> > If I can achieve partially, the links returning from application webpage
> > are pointing to root (ie)
> >
> > Expecting: http://exmaple.com/app1/results
> > But: http://example.com/results.
> >
>
>
> Hi Satish,
>
You might want use `proxy_pass`[0][1].
>
> Something like:
>
> ```
> location /app1 {
>   proxy_pass http://localhost:9000/;
> }
> location /app2 {
>   proxy_pass http://localhost:8000/;
> }
> ```
>
> [0] http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
> ​[1]
> https://serverfault.com/questions/379675/nginx-reverse-proxy-url-rewrite​
>
>
> ​Cheers,​
> - Saurabh
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>

I got some link for subdirectory hosting. I following things, hope will get
solution:

http://geekbandtheory.com/djanginx-django-with-nginx/
http://librelist.com/browser/flask/2010/7/21/running-behind-proxy-with-url-prefix-other-than/#15215a54b84bb794f1c6203e934c4f54
https://github.com/benoitc/gunicorn/issues/472

Thanks Suarabh and Gora.
-- 
Regards,
Sathishkumar D


More information about the BangPypers mailing list