Есть контроллер NewsController с actionIndex.
В результате у меня ссылка /planetarium/index.php/news работает, а /planetarium/news выдает ошибку CHttpException: Unable to resolve the request "planetarium/index.php". in /usr/local/lib/php5/yii-1.1.13/framework/web/CWebApplication.php on line 286
Вроде бы пытался по-всякому применять советы по избавлению от index.php, но никак не получается. И не могу никак понять в чем я затупил.
Конфиг nginx:
Код: Выделить всё
server {
set $host_path "/home/vit/work/fpm";
server_name fpm;
root $host_path;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ $yii_bootstrap?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
# отключаем обработку запросов фреймворком к несуществующим статичным файлам
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
# передаем PHP-скрипт серверу FastCGI, прослушивающему адрес 127.0.0.1:9000
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
# позволяем yii перехватывать запросы к несуществующим PHP-файлам
set $fsn $yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
# PATH_INFO и PATH_TRANSLATED могут быть опущены, но стандарт RFC 3875 определяет для CGI
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
location /planetarium {
try_files $uri $uri/ /planetarium/index.php?$query_string;
}
# не позволять nginx отдавать файлы, начинающиеся с точки (.htaccess, .svn, .git и прочие)
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
Конфиг main.php приложения:
Код: Выделить всё
<?php
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.controllers.abstract.*',
'application.interfaces.*',
),
'modules'=>array(
),
// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
),
),
'db'=>array(
'connectionString' => 'mysql:host='.DB_HOST.';dbname='.DB_NAME,
'emulatePrepare' => true,
'username' => DB_USER,
'password' => DB_PASS,
'charset' => 'utf8'
),
'request' => array(
'baseUrl' => BASE_URL
),
'errorHandler'=>array(
'errorAction'=>'errors/index',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
),
),
),
'params'=>array(
'adminEmail'=>'[email protected]',
),
);