美文网首页
Nginx HTTPS 支持

Nginx HTTPS 支持

作者: 峰远 | 来源:发表于2016-12-08 17:15 被阅读0次
    #80端口转到443端口
    server{
        listen                  80;
        server_name             www.域名.com;
        rewrite ^(.*) https://$server_name$1 permanent;
    }
    server {
        listen       443;
        server_name  www.域名.com;
        ssl                     on;
        ssl_certificate         key/server.crt;
        ssl_certificate_key     key/server.key;
        ssl_session_timeout     5m;
    
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
    
        location / {
            root   html;
            index  index.html index.htm;
        }
    }
    
    http https 同时支持
    server {
        listen       8080 default backlog=2048;
        listen       443 ssl;
        server_name  www.域名.com;
        rewrite ^(.*)https://$server_name$1 permanent;
        #ssl                    on;
        ssl_certificate         key/server.crt;
        ssl_certificate_key     key/server.key;
        ssl_session_timeout     5m;
    
        #charset koi8-r;
    
        #access_log  logs/host.access.log  main;
    
        location / {
            root   html;
            index  index.html index.htm;
        }
    }

    相关文章

      网友评论

          本文标题:Nginx HTTPS 支持

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