Reputation: 2738
I have https://testsite.com working on django + gunicorn + nginx + https.
My nginx conf (everything fine):
server {
listen 80;
server_name testsite.com;
access_log off;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name *.testsite.com;
proxy_set_header X-Forwarded-Protocol $scheme;
# lots of sll staff
location / {
# point to gunicorn
proxy_pass http://176.112.198.254:8000/;
}
}
I need to implement cities on subdomains pointing to subdirectories (exept main_city).
So i need urls like this:
https://testsite.com/some_url/ should point to https://testsite.com/main_city/some_url/ https://city1.testsite.com/some_url/ should point to https://testsite.com/city1/some_url/ https://city2.testsite.com/some_url/ should point to https://testsite.com/city2/some_url/
How can i do that?
Big thx for help!
Upvotes: 1
Views: 462
Reputation: 906
You have to define upstrem directive. Currently your nginx can not proxy to your web application.
http://nginx.org/en/docs/http/ngx_http_upstream_module.html
upstream backend {
server backend1.example.com weight=5;
server backend2.example.com:8080;
server unix:/tmp/backend3;
server backup1.example.com:8080 backup;
server backup2.example.com:8080 backup;
}
server {
location / {
proxy_pass http://backend;
}
}
Upvotes: 1