Apache错误.log运行Yii应用程序时出错



在 ubuntu 机器中测试我的 yii 应用程序时,/var/log/apache2/error.log每次访问页面时都会显示以下错误。

客户端被服务器配置拒绝:/var/www/item,引用:https://xxx.xx.xx.xxx/storemgr/issue/manage

在 Windows 中测试时没有错误日志记录。

但是我在浏览器中访问页面时没有遇到任何问题。

我使用的网址:https://xxx.xx.xx.xxx/storemgr/item/manage

我的 Apache 配置:

<Directory /var/www/storemgr/>
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

主网址管理器.php

    'urlManager'=>array
    (
        'urlFormat'=>'path',
        'showScriptName'=>false,
        'rules'=>array
        (
            '<controller:w+>/<id:d+>'=>'<controller>/view',
            '<controller:w+>/<action:w+>/<id:d+>'=>'<controller>/<action>',
            '<controller:w+>/<action:w+>'=>'<controller>/<action>',
        ),
    ),

.htaccess webroot 的内容(即 storemgr)

<ifModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
</ifModule>

请帮忙。

config.php

'urlManager' => array(
            'urlFormat' => 'path',
            'showScriptName' => false,
            'caseSensitive' => false,
            'rules' => require(SITE_PATH_CONFIG . '_routes.php'
                )
        ),

.htaccess

RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php

虚拟主机

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName siteName
    DocumentRoot /folder/name
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /folder/name/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

再次检查您的配置。还想说,基于"Windows"的适应中的路由存在问题 - 简单的例子是"\"不等于"/",因此在 *nix-list 和 Windows 操作系统中可能会很麻烦。

还要重新检查您的路线。它路由它匹配它将被使用,所以首先添加(到路由数组)路由短路由,简单示例它应该如何

'some/<id>/<action>' => 'some/doAction',
'some/<id>/someAction' => 'some/doActionSome'

第二个永远不要使用。所以你应该先添加它。

PS:找出问题所在的最佳方法 - 是找到它崩溃的位置,在什么控制器/方法等上。当你找到 - 你可以在那里查看使用的路线并了解你的麻烦(或提出问题)。没有它,没有人可以帮助您解决问题。

它根本没有Yii问题。我猜你最近升级到 13.10 Saucy。这是Apache Server的变化。您需要添加新指令:授予这是一个例子

<Directory /var/www/storemgr/>
   Order allow,deny
   Allow from all
   # New directive for new Apache 
   Require all granted
</Directory>

在此处查看升级到 2.4 时的更改

最新更新