我试图从具有nginx的自身的VPS是一个Azure的Web应用程序迁移PHP的Web应用程序。在NGINX配置中,还有一些需要迁移的重写规则。现在,该应用程序正在运行,除了重写之外。
我做
什么。所以,给我创建了一个名为applicationHost.xdt
文件,并将其添加到/site
文件夹中的重写。我测试了新的.xdt
正在通过添加一个超时规则来读取,后来我发现它已被插入主配置文件/local/Config/applicationhost.config
。然而,我的规则不存在,它根本不工作。
我也试过在名为web.config
的/wwwroot
文件夹下添加下面的文件。
applicationHost.xdt:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.applicationHost>
<webLimits xdt:Transform="SetAttributes(connectionTimeout)"
connectionTimeout="00:00:30" />
</system.applicationHost>
<location path="{main_location_for_web_app}" xdt:Transform="InsertIfMissing" >
<system.webServer xdt:Transform="InsertIfMissing">
<rewrite xdt:Transform="InsertIfMissing">
<rules xdt:Transform="InsertIfMissing" lockElements="clear">
<rule name="amr" enabled="true" stopProcessing="true" lockItem="true">
<match url="{my app url}/introduction.php" />
<action type="Redirect" url="{my app url}/reset.php" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
</configuration>
我是相当新的这一切,但它是我需要做的任务。我很感激,如果有人能告诉我我做错了什么或调试这个最好的方法。
谢谢你。我仍然试图让它工作。我使用了你提供的示例,而不是'introduction.php',我使用'。*'不适合我。调试它的最佳方法是什么?我怎么能100%确定'web.config'文件正在被读取。再次感谢。 –
发现我的错误。我的代码在'/ wwwroot/html'而不是'/ wwwroot'中,因此'web.config'文件需要位于'/ wwwroot/html /'中,因为它是Web应用程序的新根。 –