网上找的一个nginx的url重写配置
2014-01-17 11:32
190 查看
#一个可用的去掉index.php重写的nginx配置 server { listen 80; server_name xxx7.com www.xxx7.com; index index.html index.htm index.php; root /var/www/xxx7; server_name_in_redirect off; location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; } location /{ if (!-e $request_filename){ rewrite ^(.*)$ /index.php?$1 last; return 403; } } } #一个可用的thinkPHP的infoPath的nginx配置 server { listen 80; server_name xxx8.com www.xxx8.com; index index.php index.html index.htm; root /var/www/xxx8; server_name_in_redirect off; location ~ .*\.php($|/) { set $script $uri; set $path_info "/"; if ($uri ~ "^(.+\.php)(/.+)") { set $script $1; set $path_info $2; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php?IF_REWRITE=1; include fcgi.conf; fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_FILENAME $document_root/$script; fastcgi_param SCRIPT_NAME $script; } location /{ if (!-e $request_filename){ #rewrite ^(.*)$ /index.php?$1 last; rewrite ^/(.*)$ /index.php/$1 last; break; } } }
相关文章推荐
- tony_nginx的安装和配置
- nginx架构
- nginx禁止其他域名解析
- nginx缓存设置
- 安装Nginx
- Nginx使用Expires增加浏览器缓存加速(转)
- nginx 一、安装简介
- nginx+fast-cgi+c
- nginx+fast-cgi+c
- ubuntu安装nginx+php-fpm+mysql
- linux下nginx安装
- nginx
- nginx源码学习资源(不断更新)
- nginx模块_使用gdb调试nginx源码
- nginx命令:启动,停止及命令参数详解
- Windows上搭个Nginx集群环境玩玩
- nginx负载均衡的分配方式
- 关于nginx限制IP或IP段的问题2011
- 编译nginx时的两个报错
- windows使用nginx实现网站负载均衡测试实例