1,php.ini中设置cgi.fix_pathinfo=1
2,修改虚拟主机的配置文件,我这是/usr/local/nginx/conf/vhost/local.phalcon.conf
server {
listen 80;
#这里在已经配置了虚拟主机local.phalcon.com域名,本机需要绑定hosts才能解析
server_name local.phalcon.com;
index index.php index.html index.htm;
set $root_path '/home/wwwroot/default/phalcon/public';
root $root_path;
try_files $uri $uri/ @rewrite ;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
allow all;
}
location ~ [^/]\.php(/|$) {
fastcgi_index /index.php;
fastcgi_pass unix:/tmp/php-cgi.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}