2016-05-10 30 views
1

私はhttps://testsite.com django + gunicorn + nginx + httpsに取り組んでいます。サブドメインをnginx(nginx + https + gunicorn + django)サブディレクトリにポイント

私のnginxのconfに(罰金のすべて):

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/; 
    } 
} 

は、私は(main_city exept)のサブディレクトリを指すサブドメイン上の都市を実装する必要があります。私はそれを行うことができますどのようにhttps://testsite.com/city2/some_url/

を指している必要がありますhttps://testsite.com/city1/some_url/ https://city2.testsite.com/some_url/を指している必要があります

https://testsite.com/some_url/https://testsite.com/main_city/some_url/ https://city1.testsite.com/some_url/を指している必要があります:

は、だから私は、このようなURLが必要ですか?

大きなthxのヘルプ!

+0

[ジャンゴマルチテナント](http://stackoverflow.com/questions/29938338/django-multi-tenancy)Iであった – Sayse

+0

@Sayse、SSLおよびHTTPS – MaxCore

+0

について何の考え重複これをサポートするために作られたすべての可能なパッケージをホストするその答えに含まれるリンクをもっと参照してください – Sayse

答えて

1

upstremディレクティブを定義する必要があります。現在のところ、あなたのnginxはあなたのWebアプリケーションにプロキシできません。

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; 
    } 
} 
関連する問題