【问题标题】:YII2 An internal server error occurred in IIS 8.5YII2 IIS 8.5 出现内部服务器错误
【发布时间】:2017-01-05 04:16:24
【问题描述】:

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

我尝试重命名 index.php 并使用简单的 echo 创建了新的 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 下安装新的,但现在出现了不同的错误。

【问题讨论】:

  • 检查frontend/runtime/logs/app.log 是否有错误。
  • 日志文件夹为空。
  • 所以你需要检查服务器错误日志。
  • 这是访问日志,需要error PHP错误日志。
  • 感谢您的帮助,但我在哪里可以找到该 php 错误日志?我有一个新安装的 windows server 2012。

标签: iis-8 yii2-advanced-app


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    您需要在 frontend/web/backend/web/

    中添加一个 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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多