Nginx下codeigniter的rewrite规则配置
2012-10-25 14:28
555 查看
由于服务器更换,web服务器也由开始的apache换成了nginx
可是以前写的内部使用的系统是使用的codeigniter,结果只有首页能访问,其它连接点击出现404错误
首先想到的就是开始的apache的rewrite不支持nginx。网上找了下适合nginx下的codeigniter的rewrite写法
加完后重启nginx即可正常访问
可是以前写的内部使用的系统是使用的codeigniter,结果只有首页能访问,其它连接点击出现404错误
首先想到的就是开始的apache的rewrite不支持nginx。网上找了下适合nginx下的codeigniter的rewrite写法
listen 80; server_name 域名; #虚拟主机域名 index index.php root /path/to/web/root; #web的根目录 location / { index index.php; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?$1 last; break; } } location ~ \.php$ { fastcgi_param SCRIPT_FILENAME /path/to/web/root/index.php; #web的根目录 需加入此cgi param才行 include fcgi.conf;#你自己的cgi配置文件在这里引入 } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log off;
加完后重启nginx即可正常访问
相关文章推荐
- codeigniter nginx rewrite规则配置【转】
- nginx配置location总结及rewrite规则写法
- nginx配置 之 location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法
- nginx rewrite重写规则配置详解
- nginx配置location总结及rewrite规则写法
- nginx rewrite重写规则与防盗链配置方法教程详解
- nginx静态文件配置 rewrite规则语法 及配置案例讲解
- nginx配置location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法
- 【转】nginx配置location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法
- WordPress与Drupal的Nginx配置rewrite重写规则示例
- PHP的Symfony和CodeIgniter框架的Nginx重写规则配置
- nginx配置location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法
- Nginx配置location总结及rewrite规则写法
- Nginx配置location及rewrite规则
- nginx配置location总结及rewrite规则写法
- nginx配置location总结及rewrite规则写法