Skip to content

Commit 591e156

Browse files
authored
Update IIS rule (#11)
1 parent 577e659 commit 591e156

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

getting-started/install.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,35 @@ location / {
8888

8989
{% tab title="IIS" %}
9090

91-
#### 启用 ARR
91+
#### 1. 安装 IIS URL Rewrite 和 ARR 模块
9292

93-
打开 IIS,进入主页的 **Application Request Routing Cache**,再进入右边的 **Server Proxy Settings...**,勾选最上面的 **Enable proxy**,同时取消勾选下面的 **Reverse rewrite host in response headers**。点击右边的 应用 保存更改。
93+
- URL Rewrite: [点击下载](https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads)
94+
- ARR: [点击下载](https://www.iis.net/downloads/microsoft/application-request-routing#additionalDownloads)
9495

95-
如果不取消勾选反向重写主机头,会导致 Cloudreve API 无法返回正确的地址,导致无法预览图片视频等
96+
如已安装,请跳过本步
9697

97-
#### 调整上传大小限制
98+
#### 2. 启用并配置 ARR
9899

99-
打开 IIS,进入主页最下面的 **配置编辑器 (Configuration Editor)**转到 `system.webServer/security/requestFiltering` 节点,调整下面的 **requestLimits -> maxAllowedContentLength** 为你希望的理论最大文件值 (单位 byte) 后点击右边的 应用 保存更改即可
100+
打开 IIS,进入主页的 **Application Request Routing Cache**再进入右边的 **Server Proxy Settings...**,勾选最上面的 **Enable proxy**,同时取消勾选下面的 **Reverse rewrite host in response headers**。点击右边的 应用 保存更改
100101

101-
如果需要对网站进行限流,可以通过右击你的站点 -> 管理网站 -> 高级设置 里设置 Limit
102+
进入主页最下面的 **配置编辑器 (Configuration Editor)**,转到 `system.webServer/proxy` 节点,调整 **preserveHostHeader****True** 后点击右边的 应用 保存更改
102103

103-
#### 保留主机头
104+
如果不取消勾选反向重写主机头,会导致 Cloudreve API 无法返回正确的地址,导致无法预览图片视频等。
104105

105-
打开 IIS,进入主页最下面的 **配置编辑器 (Configuration Editor)**,转到 `system.webServer/proxy` 节点,调整下面的 **preserveHostHeader****True** 后点击右边的 应用 保存更改即可。
106+
#### 3. 配置反代规则
106107

107-
#### 配置反代规则
108+
这是 `web.config` 文件的内容,将它放在目标网站根目录即可。此样例包括两个规则与一个限制:
108109

109-
这是 `web.config` 文件的内容,包括了两个规则:强制 HTTPS 和 反代。请根据你的需求使用,同时记得更改反代地址的端口号为你实际设置的。
110+
- HTTP to HTTPS redirect (强制 HTTPS,需要自行配置 SSL 后才可使用,不使用请删除该 rule)
111+
- Rerwite (反代)
112+
- `requestLimits` 中的 `60000000` 为传输文件大小限制,单位 byte,如果您要使用本地存储策略请更改大小为理论最大文件尺寸
110113

111114
```xml
112115
<?xml version="1.0" encoding="UTF-8"?>
113116
<configuration>
114117
<system.webServer>
115118
<rewrite>
116119
<rules>
117-
<clear />
118120
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
119121
<match url=".*" />
120122
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
@@ -128,10 +130,15 @@ location / {
128130
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
129131
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
130132
</conditions>
131-
<action type="Rewrite" url="http://localhost:1300/{R:0}" />
133+
<action type="Rewrite" url="http://localhost:5212/{R:0}" />
132134
</rule>
133135
</rules>
134136
</rewrite>
137+
<security>
138+
<requestFiltering allowDoubleEscaping="true">
139+
<requestLimits maxAllowedContentLength="60000000" />
140+
</requestFiltering>
141+
</security>
135142
</system.webServer>
136143
</configuration>
137144
```

0 commit comments

Comments
 (0)