V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Liang
V2EX  ›  程序员

请教阿里云的 SLB 和 SSL 的配置问题

  •  
  •   Liang · 2018-12-11 20:21:10 +08:00 · 1355 次点击
    这是一个创建于 1961 天前的主题,其中的信息可能已经有所发展或是发生改变。

    各种 Google 找不到答案,无奈只好请教一下大家。

    先交代一下背景:

    • 网站使用阿里云 SLB 做负载均衡的,证书也配在 SLB。
    • SLB 的 https 实际上转发的是 http443,正常的访问是可以的。但是今天输入一个已存在的目录是,少输入了「/」结尾,nginx 进行了补全,然后返回的 Location 是 http443,由于 SLB 的 http443 没做转发,就导致网站无法访问了。找了很多的方法,都没办法解决这个问题,有劳各位大大了。

    现象重现:

    $ curl -I https://test.com/abc
    
    HTTP/1.1 301 Moved Permanently
    Date: Tue, 11 Dec 2018 11:48:50 GMT
    Content-Type: text/html
    Content-Length: 178
    Connection: keep-alive
    Location: http://test.com:443/abc/
    

    slb 配置

    http[80] => http[80]
    https[443] => http[443]
    

    nginx 配置

    server {
        listen 80;
        server_name test.com;
        return 301 https://test.com$request_uri;
    }
    
    server {
        listen 443 ssl;
        server_name test.com;
    
        ssl on;
        ssl_certificate /etc/ssl/test.com.crt;
        ssl_certificate_key /ect/ssl/test.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;
    
        index index.html;
        root /data/web/test.com;
    }
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5174 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 09:39 · PVG 17:39 · LAX 02:39 · JFK 05:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.