首页 > Web开发 > 详细

OpenResty 配置SSL 同时支持http 全部转发到 https中

时间:2020-05-07 16:32:35      阅读:421      评论:0      收藏:0      [点我收藏+]

nginx 配置https
server {
listen 443 ssl;
server_name www.aidici.com;
ssl_certificate D:\aidici.com_chain.crt;
ssl_certificate_key D:\aidici.com_key.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;

    # 获取当前系统时间,并返回
    location /getTime {
        default_type text/html;
        content_by_lua ‘
            ngx.say(ngx.time() * 1000);
        ‘;   
    }
 }

将http 转发到 https中
server {
listen 80;
server_name www.aidici.com;
rewrite ^(.) https://$server_name$1 permanent; #跳转到Https
# rewrite ^/(.
) https://$server_name$request_uri permanent; #request_uri 参数 获取到的不是很对 就使用了$1这种方式
}

OpenResty 配置SSL 同时支持http 全部转发到 https中

原文:https://www.cnblogs.com/JC-0527/p/12843710.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!