Nginx部署.NET6 Web程序

部署步骤

  1. 下载Nginx解压到磁盘
  2. 修改conf\nginx.conf文件,配置监听端口、域名、本地运行地址
  3. 双击nginx.exe启动

nginx配置

#user nobody;
worker_processes 1; #进程数
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
client_max_body_size 10M;
client_body_buffer_size 128k;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#支持websoket,BlazorServer
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default; # 端口
server_name xxxx.com; #域名
rewrite ^(.*) https://$server_name$1 permanent; #自动跳转https
}
# https配置
server {
listen 443 ssl; # 端口
server_name xxx.com; #域名
ssl_certificate xxx.com.pem; #证书
ssl_certificate_key xxx.com.key; #证书key
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:5000; #本地.NET6程序
#webscoket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
posted @   known  阅读(1748)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2010-09-04 Python学习笔记(8):面向对象
2010-09-04 如何在SharePoint中创建Custom Master Page
点击右上角即可分享
微信分享提示