在nginx下开发项目时,有时候希望在同一个目录下有多个项目,如
这时候nginx需要在配置项目做一些修改。
用phalcon框架来说,我要访问的真实路径如下:
http://localhost/basic/public/index.php?_url=/frontend/index/index
但是我想在浏览器中输入的路径为:
http://localhost/basic/frontend/index/index
这时,在nginx的配置文件中添加一行
location /basic/ {
if (!-e $request_filename){
rewrite ^$ /basic/public/ last;
rewrite ^/basic/(.*)$ /basic/public/index.php?_url=/$1 last;
}
}
即可访问实现这样的路由访问。
原文地址:http://blog.csdn.net/somehow1002/article/details/78701709