[BangPypers] Multiple Django app with nginx
Saurabh Kumar
thes.kumar at gmail.com
Wed May 18 23:57:13 EDT 2016
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
More information about the BangPypers
mailing list