2017-07-08 11 views
2

私はMVCコアでウェブサイトを作ってCentOS 7 VPSでウェブに公開しようとしました。それはうまく動作し、私はそれをカールするときに応答します。それから私はnginxをインストールし、それは私のコンピュータから試してみるときに、デフォルトのページを示した。次に、nginx.confを下のものに変更しました。私が得るのは、502の悪いゲートウェイです。 nginxのログでは、取得要求が受信されただけです。どのようなアイデアをチェックすべきですか?CentOS上の502悪いゲートウェイmvcコアアプリケーション

user nginx; 
worker_processes auto; 
error_log /var/log/nginx/error.log; 
pid /run/nginx.pid; 

# Load dynamic modules. See /usr/share/nginx/README.dynamic. 
include /usr/share/nginx/modules/*.conf; 

events { 
    worker_connections 1024; 
} 

http { 
    log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
         '$status $body_bytes_sent "$http_referer" ' 
         '"$http_user_agent" "$http_x_forwarded_for"'; 
    access_log /var/log/nginx/access.log main; 

    sendfile   on; 
    tcp_nopush   on; 
    tcp_nodelay   on; 
    keepalive_timeout 65; 
    types_hash_max_size 2048; 

    include    /etc/nginx/mime.types; 
    default_type  application/octet-stream; 

    # Load modular configuration files from the /etc/nginx/conf.d directory. 
    # See http://nginx.org/en/docs/ngx_core_module.html#include 
    # for more information. 
    # include /etc/nginx/conf.d/*.conf; 
    server { 
     listen 80; 
     location/{ 
      proxy_pass http://localhost:5000; 
      proxy_http_version 1.1; 
      proxy_set_header Upgrade $http_upgrade; 
      proxy_set_header Connection keep-alive; 
      proxy_set_header Host $host; 
      proxy_cache_bypass $http_upgrade; 
     } 
    } 
} 

答えて

4

私はApacheを試しても同じ問題がありました。それから私は解決策を見つけました。あなたはhttpd_can_network_connectを設定しなければなりません。

http://sysadminsjourney.com/content/2010/02/01/apache-modproxy-error-13permission-denied-error-rhel/

Aは、著者が話していた監査ブログでのエラーメッセージを見つけられませんでしたが、私は彼の解決策を試してみました、それが働きました。

私は今4日間CentOSを使用していますが、問題を解決するために少し設定する必要があります。これらの解決策はウェブ上ではかなり隠されており、その分野を扱っているほとんどの記事には言及されていないので、私は多くの時間を失いました。だから私はSELinuxについての著者の意見を共有します。おそらく私は別のLinuxディストリビューションを試してみるでしょう。 私は公式のマイクロソフトのチュートリアル「LinuxでApacheを使用してASP.NET Coreのホスティング環境をセットアップし、それに展開する」も興味深いと思います。彼らが使用するオペレーティングシステムもCentOSです。そして、このことについても言及していません。

関連する問題