Fork me on GitHub

配置 Nginx 转发 Kestrel

nginx.conf配置示例如下

Tips: 使用Kestrel时, Program.cs、appsettings.json、launchSettings.json中设置的端口号保持一致。


###############################管理主页##################################
server {
listen 80;
server_name www.www.com; #域名
location / {
proxy_pass http://localhost:8888; #Start Kestrel Process Address(内部的kestrel的地址)
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;
}
#若网站存在证书。需要添加以下配置
ssl_certificate cert/214292799730473.pem;// 改成你的证书的名字
ssl_certificate_key cert/214292799730473.key;// 你的证书的名字
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
};


###############################公司主页##################################
server {
listen 80;
server_name test.www.com; #域名
location / {
    proxy_pass http://localhost:12345; #Start Kestrel Process Address(内部的kestrel的地址)
    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;
}}
posted @ 2021-06-05 15:35  madman98  阅读(243)  评论(0编辑  收藏  举报