阿里云服务器代金券领取(最高2000元)
https://www.aliyun.com/minisite/goods?userCode=3ls0qk0b

阿里云的nginx的https配置问题

    server {
        listen       443 ssl;
        server_name  www.xxx域名.com;

        root html;
        index index.html index.html;
        ssl_certificate      cert/4774584_www.xxx域名.com.pem;
        ssl_certificate_key  cert/4774584_www.xxx域名.com.key;

       # ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

       # ssl_ciphers  HIGH:!aNULL:!MD5;
         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;

        location / {
            root   html;
            index  index.html index.htm;
        }


location /baidu {
        proxy_pass http://www.baidu.com/;
}

        }

如果需要将nginx反向代理的网址也可以使用htts访问,那么需要在443server中添加location /反向代理地址

 

如果需要http自动https,则应该在80server中添加:             rewrite ^(.*)$ https://$host$1 permanent;

server {
        listen       80;
        server_name  localhost;

  rewrite ^(.*)$ https://$host$1 permanent;   #将所有HTTP请求通过rewrite重定向到HTTPS。
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

       # location / {
       #     root   html;
       #     index  index.html index.htm;
       # }
}

 

阿里云新用户一折大奖+优惠 链接:https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=3ls0qk0b&utm_source=3ls0qk0b

 

posted @ 2020-11-23 23:54  H有何不可?  阅读(322)  评论(0编辑  收藏  举报
阿里云服务器代金券领取(最高2000元)
https://www.aliyun.com/minisite/goods?userCode=3ls0qk0b