2017-08-17 32 views
0

私は、nginxとスーパーバイザを使用してEC2 ubuntuインスタンス上で実行されているいくつかのasp.netコアWebアプリケーションを取得するために取り組んでいます。私は一度に1つのアプリケーションを実行し、単に私のnginx設定で私のポートを交換して再ロードすることに成功しています。実行中の.netcoreアプリケーションの間で交換することができます5000と5001。私はそれらを両方にするnginxの設定を把握することはできませんパス(hostname/app1、hostname/app2)で作業します。asp.net core nginxの複数のアプリケーション

ここに私のNginx Configがあります。誰かが私が間違っていたことを指摘できましたか?私の上司が両方のアプリケーションを実行しています。ログを調べ、デフォルトの場所「/」でポートを変更することで確認できます。

server { 
    listen 80 default_server; 
    listen [::]:80 default_server; 

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


    location /app1 { 
      rewrite ^/app1(.*) /$1 break; 
      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; 
    } 

    location /app2{ 
      rewrite ^/app2(.*) /$1 break; 
      proxy_pass http://localhost:5001; 
      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; 
    } 
} 

私はまだそこに置くことがないので、デフォルトのルートは単純ではありません。

答えて

1

溶液は、位置とはProxyPass

server { 
    listen 80 default_server; 
    listen [::]:80 default_server; 

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


    location /app1/ { 
      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; 
    } 

    location /app2/ { 
      proxy_pass http://localhost:5001/; 
      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; 
    } 
} 
にスラッシュを末尾たように見えます
関連する問題