【问题标题】:HTTP to HTTPS on domain hosted in VPS using IIS使用 IIS 在 VPS 中托管的域上的 HTTP 到 HTTPS
【发布时间】:2018-06-05 04:35:08
【问题描述】:

我有一个 DNS 设置指向 VPS 的域。

VPS 有一个 IIS 10 实例,它使用引导程序使用 html 托管简单网站。

我安装了 SSL 证书并为 https 部分添加了绑定。

我可以在 http 和 https 上浏览域。

我在 web.config 中添加了以下规则:

<system.webServer>
<rewrite>
    <rules>
    <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions> 
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions> 
    <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>   
    </rules>
</rewrite>
</system.webServer>

但是这似乎没有帮助。我仍然可以在 http 上浏览。

我尝试了以下方法:

  1. 尝试安装 URL Rewrite 但看起来 Windows Server 2016 和 IIS 10 不允许安装

  2. 尝试启用需要 SSL 选项。

    • 这显示了 http 中的网站,没有图片但有文字
    • 网站在https中正确显示

我在这里错过了什么?

【问题讨论】:

标签: iis https windows-server


【解决方案1】:

我安装了错误的 URL 重写。

这篇文章帮助我解决了正确链接的问题。

在 Windows Server 2016 上自动 IIS 将 http 重定向到 https:https://gridscale.io/en/community/tutorials/iis-redirect-http-to-https-windows/

【讨论】:

    猜你喜欢
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多