.net core 发布 Ubuntu

准备工作:
1.安装VMware虚拟机;
2.将Ubuntu Server 安装在虚拟机;(安装:https://www.ubuntu.com/download)
3.在Ubuntu 上安装Nginx; (安装:https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04)
4.在Ubuntu 上安装 net.core SDK FOR Ubuntu ;(安装:https://www.microsoft.com/net/download/linux-package-manager/ubuntu18-04/sdk-current)
5.准备好PUtty ,能快速连接虚拟机系统,能快速复制,粘贴;
6.准备FileZila,FTP工具,用于上传项目到Ubuntu;

注意事项:
1.VS的.net core sdk 必须与 Ubuntu .net core sdk 版本一致;
2.VS新建项目注意不要钩选https;

Nginx 操作:
回到根目录: cd ..
进入目录: cd /xxx/xxx2
进入目录: cd xxx3
打开文件: vi xxxx.conf (ESC后 再":",保存:wq, 不保存:q!,编辑:s)
启动VS项目:dotnet project.dll;
重启Nginx: sudo nginx -t , sudo nginx -s reload

IP 访问网站:
配置nginx的代理转发,修改/etc/nginx/sites-available/default,修改内容如下
//如果没有权限修改,请使用 sudo chmod 777 xxx 修改权限(xxx表示文件夹路径或者文件名)

server {
listen 80;
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;
}
}

猜你喜欢

转载自www.cnblogs.com/hiee23/p/9239412.html