美文网首页
nginx配置https

nginx配置https

作者: ZZES_ZCDC | 来源:发表于2018-08-25 21:43 被阅读90次

    只配置443会导致http和https共存,
    只要再80里配置个重定向即可return 301 https://$server_name;

    server {    
            listen      80;
            server_name www.zzes1314.cn;
    
            return 301 https://$server_name;
            location / {
                root html/mainPage;
                index index.html index.htm;
            }
        }
    
        # HTTPS server
        #
        server {
           listen       443 ssl;
           server_name  www.zzes1314.cn;
           ssl on;
           ssl_certificate      1_www.zzes1314.cn_bundle.crt;
           ssl_certificate_key  2_www.zzes1314.cn.key;
    
           ssl_session_cache    shared:SSL:1m;
           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 / {
               root html/mainPage;
               index index.html index.htm;
           }
        }
    

    配置http2

    ./configure  --with-http_v2_module
    make
    make install
    

    nginx.conf中 就在https配置后加个http2即可

        server {
           listen       443 ssl http2;
    

    相关文章

      网友评论

          本文标题:nginx配置https

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