我在虚拟机上搭建了一个LNMP环境,基于php的yaf框架写了个小demo。nginx的配置文件如下所示:
server {
listen 8050;
server_name www.myblog.com;
root /usr/share/nginx/www.myblog.com/public/;
index index.php index.html index.htm;
location ~ .+\.php($|/) {
root /usr/share/nginx/www.myblog.com/public/;
fastcgi_pass 127.0.0.1:8051;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~.*\.(js|csss)?$
{
root /usr/share/nginx/www.myblog.com/application/views/;
}
}
目前,如果直接访问域名,能访问到默认的index路径下的控制器内容。但controllers文件夹下的其他php文件,无法通过“域名/文件路径”的方式访问。求各位大神帮忙看看原因。。。多谢。。。