2016-10-31 12 views
0

私はhttp://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.htmlジャンゴnginxのuWSGI 502不正なゲートウェイは常に

次されていると

http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html#running-the-django-application-with-uwsgi-and-nginx

まで行き、uwsgi --socket mysite.sockを開始しました - モジュールmysite.wsgi --chmod-socket = 664これは起動しますが、ブラウザ上で私のWebページをロードするとき502 Bad Gate

Djangoのバージョン1.10.2

エラーである

エラー] 25444#25444:* 1接続()失敗しました、クライアント上流側に接続している間 (111接続が拒否):127.0.0.1を、サーバー:mytest.com、 要求: "GET/HTTP/1.1"、上流: "uwsgi://127.0.0.1:8001"、ホスト: "127.0.0.1:8000"

何ができますか問題 ?プロジェクトディレクトリ内の

# configuration of the server 
server { 
    # the port your site will be served on 
    listen  8000; 
    # the domain name it will serve for 
    server_name mytest.com; # substitute your machine's IP address or FQDN 
    charset  utf-8; 

    # max upload size 
    client_max_body_size 175M; # adjust to taste 

    # Django media 
    location /media { 
     alias /home/karesh/tutorial/uwsgi-tutorial/mysite/media; # your Django project's media files - amend as required 
    } 

    location /static { 
     alias /home/karesh/tutorial/uwsgi-tutorial/mysite/static; # your Django project's static files - amend as required 
    } 

    # Finally, send all non-media requests to the Django server. 
    location/{ 
     uwsgi_pass unix:/home/karesh/tutorial/uwsgi-tutorial/mysite/mysite.sock; 
     include  /home/karesh/tutorial/uwsgi-tutorial/mysite/uwsgi_params; # the uwsgi_params file you installed 
    } 
} 

uwsgi_paramsファイルが

uwsgi_param QUERY_STRING  $query_string; 
uwsgi_param REQUEST_METHOD  $request_method; 
uwsgi_param CONTENT_TYPE  $content_type; 
uwsgi_param CONTENT_LENGTH  $content_length; 

uwsgi_param REQUEST_URI  $request_uri; 
uwsgi_param PATH_INFO   $document_uri; 
uwsgi_param DOCUMENT_ROOT  $document_root; 
uwsgi_param SERVER_PROTOCOL $server_protocol; 
uwsgi_param REQUEST_SCHEME  $scheme; 
uwsgi_param HTTPS    $https if_not_empty; 

uwsgi_param REMOTE_ADDR  $remote_addr; 
uwsgi_param REMOTE_PORT  $remote_port; 
uwsgi_param SERVER_PORT  $server_port; 
uwsgi_param SERVER_NAME  $server_name; 
+0

このエラーが示すように、nginxはソケットではなくポート経由で接続しようとしています。 nginxの設定を表示する必要があります。 –

+0

私はチュートリアルのようにしました。私のmysite_nginx.confはサイト内でリンクされています。 –

+0

設定を変更した後、nginxを再起動しましたか? –

答えて

0

いくつか、それはあなたを助けることができる: 1)を有効にSEとCentOSの上nginxグループ 2)にuWSGIを実行するユーザーを追加、ソケットを置く最も良い方法は/run の下のディレクトリです。3)ソケットのアクセス権を<your_user>:nginxに設定します(言い換えれば、あなたのユーザとnginxグループのソケットの許可を設定してください)。

これらの手順は、通常、パーミッションエラーで把握するのに役立ちます。

関連する問題