YII2 IIS 8.5中发生内部服务器错误

时间:2017-01-05 04:16:24

标签: iis-8 yii2-advanced-app

我使用composer在我的笔记本电脑上使用xampp成功安装和运行yii2版本2.0.10但是当我在IIS v 8.5的Windows server 2012 r2中安装它时,它显示An internal server error occurred错误。我没有更改或编辑全新安装中的任何文件。

enter image description here enter image description here

我尝试重命名index.php并使用简单的回声创建新的index.php并且它运行良好。

编辑 - 这是服务器日志。

#Software: Microsoft Internet Information Services 8.5
#Version: 1.0
#Date: 2017-01-05 23:56:51
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-01-05 23:56:51 ::1 GET /advanced/frontend/web/ - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/55.0.2883.87+Safari/537.36 http://localhost/advanced/frontend/ 500 0 0 5893
2017-01-05 23:56:56 ::1 GET /advanced/ - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/55.0.2883.87+Safari/537.36 - 200 0 0 21
2017-01-05 23:56:59 ::1 GET /advanced/frontend/ - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/55.0.2883.87+Safari/537.36 http://localhost/advanced/ 200 0 0 3
2017-01-05 23:57:01 ::1 GET /advanced/frontend/web/ - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/55.0.2883.87+Safari/537.36 http://localhost/advanced/frontend/ 500 0 0 103
2017-01-05 23:59:35 ::1 GET /advanced/frontend/web/ - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/55.0.2883.87+Safari/537.36 http://localhost/advanced/frontend/ 500 0 0 61
2017-01-05 23:59:35 ::1 GET /favicon.ico - 80 - ::1 Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/55.0.2883.87+Safari/537.36 http://localhost/advanced/frontend/web/ 404 0 2 10

编辑2。

尝试在development下安装新的,现在它出现了不同的错误。

enter image description here

2 个答案:

答案 0 :(得分:0)

通常Yii是.htaccess的mod-rewrite配置。您是否将其转换为等效的web.config,以便IIS可以解释它?

答案 1 :(得分:0)

您需要在前端/网络后端/网络/

中添加 web.config 文件

IIS不支持.htaccess文件

web.config的内容

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
  <rewrite>
    <rules>
      <rule name="Hide Yii Index" 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" appendQueryString="true" />
      </rule> 
    </rules>
  </rewrite>
</system.webServer>
</configuration>

backend web screenshot

frontend web screenshot