I want to serve multiple django projects (actually django rest API apps) On one domain but serve each of them on seperated url. like this:
and so on. I will be using nginx to config it. But i'm facing some problems that wants your helps:
Note:
I don't want full detail cause i know concepts. just some hints and usefull commands will do.
Update:
For example i have a django app which has a url test. and i want this path to be served on server with /app1/test. The problem is that when is send request to /app1/test, Django doesn't recognize it as /test, instead as /app1/test and because /app1 is not registered in urls.py will give 404 error.
here is a sample of my nginx config:
server {
listen 80;
server_name test.com;
location /qpp1/ {
include uwsgi_params;
proxy_pass http://unix://home//app1.sock;
}
location /qpp2/ {
include uwsgi_params;
proxy_pass http://unix://home//app2.sock;
}
}
You can try to play with proxy_cookie_path directive:
server {
...
location /app1/ {
proxy_cookie_path / /app1/;
proxy_pass http://backend1/;
}
location /app2/ {
proxy_cookie_path / /app2/;
proxy_pass http://backend2/;
}
}
Update
Here is another variant of configuraion to test.
upstream qpp1 {
server unix:/home/.../app1.sock;
}
upstream qpp2 {
server unix:/home/.../app2.sock;
}
server {
listen 80;
server_name test.com;
location /qpp1/ {
include uwsgi_params;
proxy_cookie_path / /qpp1/;
proxy_pass http://qpp1/;
}
location /qpp2/ {
include uwsgi_params;
proxy_cookie_path / /qpp2/;
proxy_pass http://qpp2/;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With