2017-06-30 15 views
0

私はvirtualenvのでCentOSのを持っているが、私は私のローカルホストでプロジェクトを使用することができますが、プロジェクトがエラーを与えるサーバーにアップロードする場合:ジャンゴサーバ - 502エラー不正なゲートウェイ

502 - 不正なゲートウェイ

私の問題はおそらく私のnginxファイルにあると思います。

server { 
listen 80; 
server_name www.site.com.br site.com.br; 
root /var/www/html/agrodez/src/; 

if ($http_host != "www.site.com.br") { 
    rewrite^http://site.com.br$request_uri permanent; 

} 
location /static/ { 
    alias /var/www/html/site/src/sistema/static/; 

} 
location /{ 
    proxy_pass http://localhost:8000; 
    include /etc/nginx/proxy_params; 
} 

答えて

0

私はジャンゴについて多くを知らないが、最近私は、サーバーの構成でチームを助けるために持っていた、と私は、次のnginxのバーチャルホストの設定を使用しました:

upstream django.local { 
    server 127.0.0.1:8000; 
} 
server { 
    listen  80; 
    server_name site.com; 

    location/{ 
     root html; 
     index index.html index.htm; 
     proxy_pass http://django.local/; 
    } 

    location /static { 
     autoindex on; 
     # this line would be STATIC_ROOT dir 
     alias /var/www/html/agrodez/src/staticfiles; 
    } 

    location /media { 
     autoindex on; 
     # this line would be MEDIA_ROOT dir; 
     alias /var/www/html/agrodez/src/media; 
    } 

    # If you want nginx logs, then can add these 
    error_log /var/log/nginx/site.com_error.log; 
    access_log /var/log/nginx/site.com_access.log; 

} 

あなたはそれを与えることができます試してみる。

+0

もユーザーのアクセス許可を確認してください。あなたがvirtualenvをセットアップしていて、nginxとは別のユーザとして実行しているなら、ファイルへのアクセスに問題があるかもしれません。 – Tuhin

関連する問題