以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
整个过程完成。