以CentOS+Nginx爲例
1、先安裝.Net Core運行環境,可跟着官網走。
安裝Runtime:https://dotnet.microsoft.com/download/linux-package-manager/centos/runtime-current
創建項目:https://dotnet.microsoft.com/learn/web/aspnet-hello-world-tutorial/create
2、使用dotnet publish部署項目,dotnet run /部署地址/項目名稱.dll
此時可以使用curl http://localhost:5000 測試一下網頁是否可訪問,但是現在不能從外部訪問該網站,需要對Nginx進行配置。
3.配置Nginx
例:sudo nano /etc/nginx/nginx.conf
更改 location / { #轉發或處理 proxy_pass http://localhost:5000; }
執行 sudo nginx -s reload
整個過程完成。