目前环境是asp+access数据库,最基本的配置。
注意:设置父路径,404页面。包含shtml 等细节,
密码复杂,对外只开放80 443 和44444远程端口
一.添加IIS服务器角色
点击任务栏左下角的“服务器管理器”,在“安装类型”选项卡中选择“基于角色或基于功能的安装”,服务器选择中直接选择当前服务器即可,在服务器角色中选Web服务器

然后到“Web服务器角色(IIS)”中选择需要的IIS组件。这里尽量额外全部勾选,可以避免以后因为缺少组件报错带来的烦恼
选择完毕后确认安装,在同时“功能”选项卡中选择安装“.NET Framework 3.5”,系统将会安装IIS以及相关的服务组件。
我们在浏览器中输入http://localhost,如果看到以下页面则表明我们已经安装完毕

二、创建IIS权限控制帐户
为了对站点文件进行权限控制,我们需要添加一个专门用户对站点目录文件权限控制的用户,我们可以在“服务器管理器”中的“工具(T)”菜单栏中选择“计算机管理器”,在这里我们来管理帐号。
我们首先在“本地用户和组”中添加一个名为“WebUsers”的用户组。
然后添加一个名为“IIS_DEDECMSUSER”的帐号,这个帐号隶属于“WebUsers”用户组。

这里需要注意取消帐号的远程控制权限,同时在用户属性“远程桌面服务配置文件”中“拒绝用户登录到远程桌面桌面会话主机服务器的权限”。

创建IIS站点
接下来我们需要创建一个站点:
(1)我们将站点根目录放在“D:www.netshield.cn”中;
(2)IIS中添加站点,域名设定为“www.netshield.cn”;
(3)我们如果需要测试访问,需要在host中添加:127.0.0.1 www.netshield.cn
完成后立即启动站点。

三,站点安全设置
1.站点目录权限配置
(1)首先我们在IIS中绑定设定的用户帐号,在站点的功能试图中的“身份验证”,双击进入后,在“匿名身份验证”中设定之前我们添加的用户帐号“IIS_DEDECMSUSER”

(2)站点根目录文件夹设定权限“D:www.netshield.cn”,我们在文件夹右键属性,在“安全”选项卡的“高级”中设定文件夹权限。

在这当中看到我们网站出现这样一个报错

根据上面的提示,我修改web.config配置文件。
修改好配置文件后又出现报错

解决办法:
- net stop iisadmin
- C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i -enable
相当于重新安装.NET -
iisreset
-
修改IIS_DEDECMSUSER用户所属组
打开IIS信息服务管理器,在网站的“MIME类型”中添加新的MIME类型。文件扩展名:.shtml;MIME类型:text/html。在默认文档里添加index.shtml 然后重启IIS服务或者回收应用程序池就可以了。


添加ssl证书,参考百度经验
https://jingyan.baidu.com/article/455a9950a95aa3a1662778da.html
404页面设置

强制https
几个值可以复制一下{HTTPS} ^OFF$

https://{HTTP_HOST}/{R:1}

添加url模块 应用池自动关闭解决办法
先添加url模块 后添加站点
url 2.0重写模块安装老版本的
第一步安装,url 2.0重写模块
iis8使用url2.0模块实现http跳转到https

点击右键选择》获取新的web平台组件

找到url 重写工具2.0并安装

找到相应网站,选择 >url重写

设定名称后 匹配URL用于路径匹配 通用 (.*)正则匹配所有路径
{HTTP_HOST}用于匹配主机域名,我的网站有泛解析,指定了匹配含有szsczx的域名

设定重定向,其中 {R:0}规则用于匹配路径
<system.webServer>
<rewrite>
<rules>
<rule name="https" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^.*?szsczx.*$" />
</conditions>
<action type="Redirect" url="https://www.szsczx.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite></system.webServer>
如果不想配置,可以修改下,把这段代码放入web.config中。可以实现用户输入主域名和二级域名直接跳转到https协议的域名地址。
http 没有www 全部跳转https www
方法一下直接在web.config配置
<?xml version="1.0" encoding="gb2312"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/404/404.html" responseMode="ExecuteURL" />
</httpErrors>
<defaultDocument>
<files>
<clear />
<add value="index.asp" />
<add value="index.shtml" />
<add value="index.html" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" enabled="false" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
<rule name="已导入的规则 1" enabled="false" stopProcessing="true">
<match url="^(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(wangdun\.cn)(:80)?" />
</conditions>
<action type="Redirect" url="http://www.wangdun.cn/{R:1}" redirectType="Permanent" />
</rule>
<rule name="已导入的规则 1-1" enabled="true" stopProcessing="true">
<match url="^(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(netshield\.cn)(:80)?" />
</conditions>
<action type="Redirect" url="http://www.netshield.cn/{R:1}" redirectType="Permanent" />
</rule>
<rule name="HTTP to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
方法二
http to https
(.*)



netshield.cn to www.netshield.cn
{HTTP_HOST} ^(netshield.cn)(:80)?


网友评论