13 08 2019

第一步:下载证书,导入证书到IIS

https://help.aliyun.com/knowledge_detail/95502.html

站点绑定https

undefined

第二部:安装URL重写模块

rewrite_amd64_zh-CN.msi

链接: https://pan.baidu.com/s/1KbzEoC21Hv1znhB5D5hfgA

提取码: 83af

想要32位的自己去百度,这里不提供,笑哭!!!

安装完成重启IIS

undefined

第三步:选中你的站点后,双击进入URL重写右键添加规则


undefined

undefined

其实这一步就是在站点的Web.config增加了一段配置:

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

如果下一个站点也需要设置HTTP重定向HTTPS,直接在Web.config增加这段配置就行。

延伸阅读
  1. 码云 VS首次提交代码报错:failed to push some refs to 'https://gitee.com/Liu_Cabbage/ASP.NET-MVC-QQ-Connect.git'
  2. FineAdmin.Mvc 使用ok-admin+ASP.NET MVC搭建的通用权限后台管理系统
发表评论