windows下安裝linux系統需要用到VMware 這個軟件,可自行百度下載,然后安裝centos7系統安裝
centos下安裝dotnetcore
在終端輸入命令:
sudo yum install libunwind libicu #(安裝libicu依賴)
安裝完成后打開:https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install 根據頁面提示中執行相關終端命令
安裝dotnetcore之后,執行命令:
dotnet new console -o hwapp # 我們初始化一個示例Hello World應用程序 (這里稍微耗時點) cd hwapp
dotnet restore
dotnet run #運行應用程序
看到打印的hello world證明 .net core的環境已經裝好了。
ngxin安裝
可參考博文:https://www.cnblogs.com/huiyi0521/p/10253341.html,建議按照步驟一步步來
nginx配置netcore站點
打開打開路徑 /etc/nginx/conf.d下的default.conf文件,修改相關代碼:
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;
}

修改之后需要重啟 nginx服務:
nginx -s reload #使其即時生效
這里需要重新啟動下項目,否則會報以下錯誤:
比如這里的項目文件名是:demo
cd demo
運行項目dll
dotnet WebApplication6.dll
訪問http://127.0.0.1
外網的話則根據ip訪問: