存档

文章标签 ‘重写’

codeigniter nginx rewrite规则配置

2013年9月9日 4 条评论

nginx如何配置才能支持codeigniter ? 1. codeigniter的url美化去掉index.php location / { root html/gxtp; index index.php; try_files $uri $uri/ /index.php?$uri&$args; } 12345         location / {            root   html/gxtp;    &nb...

分类: nginx 标签: , , ,

nginx下支持PATH_INFO详解

2012年12月7日 6 条评论

要想让nginx支持PATH_INFO,首先需要知道什么是pathinfo,为什么要用pathinfo? pathinfo不是nginx的功能,pathinfo是php的功能。 php中有两个pathinfo,一个是环境变量$_SERVER['PATH_INFO'];另一个是pathinfo函数,pathinfo() 函数以数组的形式返回文件路径的信息;。 nginx能做的只是对$_SERVER['PATH_INFO]值的设置。 下面我们举例说明比较直观。先说php中两种pathinfo的作用,再说如何让nginx支持pathinfo。 php中的两个pathinfo php中的pathinfo() pathinfo()函数可以对输入的路径进行判断,以数组的形式返回文件路径的信息,数...

分类: nginx 标签: ,

nginx rewrite 指令

2012年9月21日 5 条评论

nginx通过ngx_http_rewrite_module模块支持url重写、支持if条件判断,但不支持else。 该模块需要PCRE支持,应在编译nginx时指定PCRE源码目录, nginx安装方法。 nginx rewrite指令执行顺序: 1.执行server块的rewrite指令(这里的块指的是server关键字后{}包围的区域,其它xx块类似) 2.执行location匹配 3.执行选定的location中的rewrite指令 如果其中某步URI被重写,则重新循环执行1-3,直到找到真实存在的文件 如果循环超过10次,则返回500 Internal Server Error错误 break指令 语法:break; 默认值:无 作用域:server,location,if ...

分类: nginx 标签: , , ,