Answer the question
In order to leave comments, you need to log in
YII. Routing setup?
The site address of the form 1.2.3.4/~abcd
The main page is displayed correctly, but there are problems with the rest, when you go to the link http://1.2.3.4/~abcd/directory - the server writes: The server can not find the requested page.
Tell me how to set up routing?
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
// стандартное правило для обработки '/' как 'site/index'
'' => 'site/index',
'user/<action:.*>'=>'user/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
'showScriptName' => false
),
Answer the question
In order to leave comments, you need to log in
Option 1
'urlManager'=>array(
'urlFormat'=>'path',
'baseUrl' => '/~abcd', // <-- имя вашей директории, куда перенесён проект
'rules'=>array(
// стандартное правило для обработки '/' как 'site/index'
'' => 'site/index',
'user/<action:.*>'=>'user/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
'showScriptName' => false
),
server {
listen 80;
charset utf-8;
set_real_ip_from 127.0.0.1;
real_ip_header X-Real-IP;
root /path/to/~abcd; # <-- полный путь к вашей директории, куда перенесён проект
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /index.php;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/tmp/php-fastcgi.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question