1、将创建的项目dotnet publish进行发布 2、运行此网站 dotnet demo.dll 3、配置nginx(1) 打开 etc/nginx/nginx.conf配置文件,listen监听端口,include引用 default.d、conf.d目录下所有以.conf结尾的配置文...
1、将创建的项目dotnet publish进行发布
2、运行此网站 dotnet demo.dll
3、配置nginx
(1) 打开 etc/nginx/nginx.conf配置文件,listen监听端口,include引用 default.d、conf.d目录下所有以.conf结尾的配置文件
include /etc/nginx/conf.d/*.conf;
server { listen 8000 default_server; listen [::]:8000 default_server; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
(2) 进入conf.d目录下进行自定义添加配置文件
server { listen 8001; 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; } # error_page 404 /404.html; # location = /40x.html { # } # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } }
(3) 自定义配置文件已创建完成,监听8001端口,proxy_pass 代理.Net Core Web 5000项目,然后进行检查与重载配置
nginx -t nginx -s reload
4、运行调试
接下来在浏览器中打开项目
沃梦达教程
本文标题为:Nginx部署ASP.NET Core项目


猜你喜欢
- WPF使用DrawingContext实现绘制刻度条 2023-07-04
- Unity Shader实现模糊效果 2023-04-27
- 如何使用C# 捕获进程输出 2023-03-10
- C# 使用Aspose.Cells 导出Excel的步骤及问题记录 2023-05-16
- c# 模拟线性回归的示例 2023-03-14
- Unity3D实现渐变颜色效果 2023-01-16
- Oracle中for循环的使用方法 2023-07-04
- 在C# 8中如何使用默认接口方法详解 2023-03-29
- .NET CORE DI 依赖注入 2023-09-27
- user32.dll 函数说明小结 2022-12-26