让nginx支持thinkmcf或thinkphp rewrite模式
2015-08-22 23:40
676 查看
如果你的ThinkPHP安装在二级目录,Nginx的伪静态方法设置如下,其中subdir是所在的目录名称。
如果你的thinkcmf安装在二级目录,Nginx的伪静态方法设置如下,其中subdir是所在的目录名称。
ps: 在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现:在nginx配置文件中添加
location /subdir/ { index index.php if (!-e $request_filename){ rewrite ^/subdir/(.*)$ /subdir/index.php?s=$1 last; } }
如果你的thinkcmf安装在二级目录,Nginx的伪静态方法设置如下,其中subdir是所在的目录名称。
location ~ /subdir/\w+ { index index.php if (!-e $request_filename) { rewrite ^/(\w+)/(.*)$ /$1/index.php/$2; } }
ps: 在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现:在nginx配置文件中添加
location / { index index.php if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } }
相关文章推荐
- nginx均衡后端两台lamp,并做动静分离
- nginx学习
- Nginx启动、重启、关闭
- LNMP(linux+nginx+mysql+php)服务器环境配置
- Django with uWSGI and nginx
- Nginx 学习
- nginx+php部署
- Nginx编译安装,启动,停止,升级。
- nginx的web连接出现过多的TIME_WAIT
- nginx test
- 如何将php的错误输出到nginx的error_log中去
- nginx 作为web服务器
- nginx的proxy_cache缓存相关配置
- 服务器搭建纪录linux+mysql+nginx+php
- 在Ubuntu系统上安装Nginx服务器的简单方法
- redhat5.5 安装 nginx1.9.2
- Mac安装神器-brew之安装nginx
- nginx+keepalived实现双机热备
- ubuntu14.04 安装nginx和php5.6.12
- 《深入理解Nginx》笔记之ngx_event_pipe_s结构体