美文网首页Linux杂谈
Nginx部署.NET Core WEB API 配置https

Nginx部署.NET Core WEB API 配置https

作者: Charles2018 | 来源:发表于2020-01-24 14:32 被阅读0次
server {
    listen 80;
    listen 443 ssl;
    server_name  b.api.onlly.online;

    ssl_certificate      /etc/nginx/ssl/b.api.onlly.online/Nginx/b.api.onlly.online_bundle.crt;
    ssl_certificate_key  /etc/nginx/ssl/b.api.onlly.online/Nginx/b.api.onlly.online.key;

    ssl_session_timeout  5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers   ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;

    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;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
    if ($server_port != 443) {
       rewrite ^/(.*) https://b.api.onlly.online/$1 permanent;
    }
}

相关文章

网友评论

    本文标题:Nginx部署.NET Core WEB API 配置https

    本文链接:https://www.haomeiwen.com/subject/gabcthtx.html