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访问: