這是我在Nginx上的第一步,所以任何幫助都會很棒。如何在子路徑上找到Asp.net核心站點
我有由兩個集裝箱的碼頭工人小,撰寫應用程序: nginx的 上傳
Nginx的80端口的主機上曝光,使Nginx的可達來自我們的內聯網,像這樣:www.mytest .net 我現在會暴露在該地址的子路徑的asp.net核心站點「上傳」,如: www.mytest.net/upload/
目前,我無法實現此,每個URL等。上傳將無法正常工作,如果我試圖將其移動到路徑上傳,我不確定是否必須配置NGINX,asp.net核心或兩個差異erently。
在Nginx.conf當前配置:
location/{
proxy_pass http://upload:80;
# The default minimum configuration required for ASP.NET Core
# See https://docs.asp.net/en/latest/publishing/linuxproduction.html?highlight=nginx#configure-a-reverse-proxy-server
proxy_cache_bypass $http_upgrade;
# Turn off changing the URL's in headers like the 'Location' HTTP header.
proxy_redirect off;
# Forwards the Host HTTP header.
proxy_set_header Host $host;
# The Kestrel web server we are forwarding requests to only speaks HTTP 1.1.
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
# Adds the 'Connection: keep-alive' HTTP header.
proxy_set_header Connection keep-alive;
}
}
就像我說的,它適用於「/」,但如果我用「上傳」就上傳網站一個簡單的形式不工作了,由於到URL不匹配。
閱讀HttpContext.Request.PathBase和一個名爲UsePathBase的新擴展。這些幫助隔離應用程序的根URL,所以它不會弄亂你的路線。 – Tratcher
@Tratcher非常感謝!我去做。你會好好回答一下嗎,所以我可以放棄嗎? –