IIS Internet 信息服务 url 重写模块 2 .如果我下载并安装 url 重写模块,它也会影响其他工作站点吗?

问题描述 投票:0回答:1

我正在 IIS 服务器上工作,并通过创建新站点添加公共文件夹(Laravel 项目)作为物理目录来在 IIS 服务器中部署 Laravel 项目。我遇到了类似的错误

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

我有这个错误。所以我下载了url重写并安装了它并且它正在工作。现在我的观点是,如果我下载并运行意味着它也会影响当前运行的位置?例如;我在 IIS 中运行 5 个站点,第 6 个站点出现错误,我下载并运行它也会影响现有站点吗?或者直接更改web.config?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="Access-Control-Allow-Headers" value="Origin, Content-Type, Authorization,X-Requested-With" />
                <add name="Access-Control-Allow-Methods" value="GET" />
                <add name="X-Download-Options" value="noopen" />
                <add name="X-Frame-Options" value="DENY" />
                <!-- if you need to allow same origin, comment above line and uncomment below line -->
                <!-- <add name="X-Frame-Options" value="SAMEORIGIN" /> -->
                <add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains" />
                <add name="X-XSS-Protection" value="1; mode=block" />
                <add name="X-Content-Type-Options" value="nosniff" />
                <add name="Referrer-Policy" value="origin-when-cross-origin" />
                <remove name="X-Powered-By" />
            </customHeaders>
        </httpProtocol>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_AUTHORIZATION}" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{URL}" pattern="(.+)/$" ignoreCase="false" />
                    </conditions>
                    <action type="Redirect" url="{C:1}" redirectType="Permanent" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>

            </rules>
        </rewrite>
        <staticContent>
        </staticContent>
        <security>
            <requestFiltering>
                <requestLimits maxQueryString="5000" />
                <verbs applyToWebDAV="false">
                    <add verb="TRACE" allowed="false" />
                </verbs>
            </requestFiltering>
        </security>
        <directoryBrowse enabled="false" showFlags="Date, Time, Size, Extension, LongDate" />
    </system.webServer>
</configuration>

如果我下载并运行重写网址,就很简单。它会影响退出网站吗?或者需要在 web.config 中进行任何更改吗?

php laravel iis iis-8
1个回答
0
投票

根据您的描述,我知道您有一个网站在 web.config 中配置了重写规则。但是您还没有安装 URL Rewrite 模块,该部分不被理解,所以当您访问该网站时会收到 500.19 错误。

最好的解决办法是安装URL重写模块。 URL 重写模块允许您在站点级别定义规则,这不应直接影响同一 IIS 服务器上托管的其他站点,因为每个站点都是使用其自己单独的 web.config 文件独立配置的。

因此安装 URL 重写模块不会影响现有站点,您也不需要在 web.config 中进行更改。

© www.soinside.com 2019 - 2024. All rights reserved.