账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    nginx监听443端口 后面是apache监听8443, apache 返回301, nginx 如何正确处理?
    56
    0

    nginx监听443,apache监听8443。

    nginx配置

    server {
      listen 443;
      # server_name *.ht920.com ht920.com;
      server_name www.ht920.com;
      ssl on;
      ssl_certificate   cert/1523974750873.pem;
      ssl_certificate_key  cert/1523974750873.key;
      ssl_session_timeout 5m;
      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 / {
        index index.html index.htm index.php;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://localhost:8443;
      }
      access_log logs/ht920.com_access.log;
    }

    现象是:
    我访问 https://www.ht920.com/e/admin/ 正常访问,
    访问 https://www.ht920.com/e/admin 不行,会跳转到 https://www.ht920.com:8443/e/admin/

    我在服务器访问了curl -k https://localhost:8443/e/admin
    得到结果是:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>301 Moved Permanently</title>
    </head><body>
    <h1>Moved Permanently</h1>
    <p>The document has moved <a href="https://localhost:8443/e/admin/">here</a>.</p>
    </body></html>

    问题是,我要如何配置,才能正确301跳转?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 共 0 条
    • 雷袭月启 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部