Php Windows Azure重写规则导致HTTP错误500
我已经做了几个小时了。我正在尝试将Codeigniter框架放入WindowsAzure网站。PHP工作得很好,但是我似乎无法让这个重写规则正常工作。这是我的Php Windows Azure重写规则导致HTTP错误500,php,windows,codeigniter,azure,Php,Windows,Codeigniter,Azure,我已经做了几个小时了。我正在尝试将Codeigniter框架放入WindowsAzure网站。PHP工作得很好,但是我似乎无法让这个重写规则正常工作。这是我的web.config文件 <?xml version="1.0"?> <configuration> <system.webServer> <rewrite> <rules> <rule nam
web.config
文件
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
当我将文件上载到Windows Azure网站并运行带有
index.php
的页面时,它返回一个HTTP错误500(内部服务器错误):在服务器尝试满足请求时遇到意外情况
,此时我不确定该怎么办,我是否需要对Windows Azure执行某些操作?我来自Apache的背景,Windows IIS对我来说是新的。任何信息都对我很有帮助,谢谢。根据您作为提供的信息,我来自Apache背景,Windows IIS对我来说是新的,我确信您的问题与支持URL重写的IIS配置有关。(如果您已经在Azure VM中安装并配置了URLRewrite,请告诉我,我将删除此答案)
默认情况下,在Windows Azure中,IIS没有安装URL重写模块,因此它无法执行任何已配置的URL重写设置,并将返回500错误
您是否已启用对Azure VM的RDP访问,以便可以远程访问并查找应用程序事件日志中记录的可能异常?如果您RDP到Azure VM并查找应用程序事件日志,您将看到一个错误,说明URL重写模块不可用
首先,您需要创建一个启动任务,以便在Azure中安装URLRewrite模块。要了解有关Windows Azure启动任务的更多信息,请访问此
下面是一个关于如何在WindowsAzure中启用URL重写的示例。(如果这是你的错误,我可以写一些关于如何让URLRewrite在WindowsAzure上工作的详细信息)我只是将ubuntu上的Apache移动到Azure网站上的IIS。根据下面的url,重写模块似乎已经启用。我还使用Web平台安装程序在我的Windows 7上设置了一个类似的环境(IIS express 7.5),Web.config也可以完美地工作 “…URL重写模块始终处于启用状态,并且在云中可用。但是,您需要安装该模块才能从本地开发环境中使用它…” 您的web.config看起来很好,这与我的非常相似-删除url中的index.php 请启用错误消息以从IIS输出详细信息,这将帮助您识别问题。我使用这些技巧来了解IIS如何查找我的文件。它是,其章节如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
另外,请记住检查config.php中的base_url是否正确
希望它有帮助
web.config
看起来与PHP或Codeigniter无关;我认为它是Azure服务器系统的一部分,可能是某种IIS配置文件。您是否尝试过他们在此处描述的内容:看起来有一种方法可以获得有关web.config文件的更具描述性的错误。微软网站上另一个类似的页面:看起来是一个奇怪的重写。它看起来会将/foo
映射到/index.php/foo
,而这可能并不存在。你确定你不想要像index.php这样的东西吗?path={R:1}
?这是正确的。应用程序的路径是domain.com/index.php/foo