V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
qiufengluoye
V2EX  ›  问与答

ksweb 搭建的网站如何在配置文件里将 http 强制跳转至 https 啊?

  •  
  •   qiufengluoye · 14 天前 · 526 次点击

    ksweb 搭建的网站如何在配置文件里将 http 强制跳转至 https 啊? 服务器为 nginx 。 一名小白,在网络上试了很多办法都不行。

    4 条回复    2024-05-04 14:29:03 +08:00
    oneisall8955
        1
    oneisall8955  
       14 天前 via Android
    nginx 配置跳转,有手就行
    JasonQii
        2
    JasonQii  
       13 天前
    JasonQii
        3
    JasonQii  
       13 天前
    然后 配置文件里面加 return 301 https://xxx.xx.xxx;
    isAK47
        4
    isAK47  
       13 天前
    server {
    ......
    ......
    ......
    if ($host ~ '^baidu.com'){
    return 301 https://www.baidu.com$request_uri;
    }
    if ($server_port !~ 443){
    rewrite ^(/.*)$ https://$host$1 permanent;
    }
    ......
    ......
    ......
    }
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2500 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 03:33 · PVG 11:33 · LAX 20:33 · JFK 23:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.