在此服务器上找不到请求的URL /前端/ ru / site / login /

时间:2013-03-30 06:08:12

标签: apache yii apache2

我有一个问题,我的项目在Windows上工作得非常好(在apache服务器上),然后我将我的项目移动到ubuntu 12.04(apache2服务器),但我的项目无效。

apache2

php 5.3.10

mysql 5.5.29-ubuntu0.12.04.2

  

on firebug:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /frontend/ru/site/login/ was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at test.local Port 80</address>
</body></html>

但我有网址/frontend/ru/site/login/

main.php:

// uncomment the following to define a path alias
Yii::setPathOfAlias('site',dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'Biotrack Backend',
    'language' => 'ru',
    'defaultController'=>'company/list',

    // preloading 'log' component
    'preload'=>array('log', 'ELangHandler'),

    // autoloading model and component classes
    'import'=>array(
        'site.common.models.*',
        'site.common.components.*',
        'application.models.*',
        'application.components.*',
        'application.components.helper.*',
        'application.modules.rights.*',
        'application.modules.rights.components.*',
    ),

    'modules'=>array(

        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'795138462',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
            'generatorPaths'=>array(
                'site.common.gii',   // псевдоним пути
                //'application.gii',
            ),
        ),

        'webshell'=>array(
            'class'=>'ext.webshell.WebShellModule',
            // when typing 'exit', user will be redirected to this URL
            'exitUrl' => '/',

3 个答案:

答案 0 :(得分:8)

你没有提供足够的信息,所以我们必须猜测,但我很确定问题出在apache重写模块中。首先,确保您的.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

接下来,确保启用了重写模块:

a2enmod rewrite

最后,确保将apache配置为允许.htaccess覆盖:

AllowOverride All

有关AllowOverride指令的更多信息,请参见此处: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

答案 1 :(得分:5)

只是在黑暗中拍摄,但正如你所说:

  

帽子我的项目在Windows上运行得非常好(在apache服务器上),然后我将我的项目移动到ubuntu 12.04(apache2服务器)

请检查您的重写规则,路径等的大小和首字母的使用情况,它们必须与您在Linux上完全匹配,因为Linux通常使用区分大小写的文件系统,而许多Windows和Mac安装没有。

答案 2 :(得分:0)

如果您认为您已经认真检查了Web服务器的配置,并且没有发现可疑的内容,那么只需尝试重新加载并重新启动或重启 Apache HTTP Server

sudo service apache2 reload

sudo service apache2 restart

不要忘记,即使是重启计算机以安装新升级所需的某些软件应用程序。