CI框架在nginx服务器上配置rewrite去掉index.php的方法: php
打开/usr/local/etc/nginx/ 目录下的配置文件xxx.conf, nginx
贴上本身的配置: 服务器
server { listen 80; server_name cc.ecjtu.net; index index.php; root /www/cyrec; //下面一段是nginx模拟pathinfo,不然CI框架的控制器没法访问 location ~ .*.php($|/) { root /www/cyrec; fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; fastcgi_pass unix:/tmp/php-fcgi.sock; fastcgi_index index.php; include fcgi.conf; } //下面就是rewirte去index.php location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } } }