nginx 默认不支持PATH_INFO
那么不能正常使用CI。
更改nginx.conf 配置
server { listen 80; server_name localhost; index index.php index.html index.htm; root /Users/renfrank/Sites/; location ~ \.php{ fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; ##########################################pathinfo 模式 set $path_info ""; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){ set $real_script_name $1; set $path_info $2; } include fastcgi.conf; fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; ##########################################nginx支持pathinfo 模式的重点 }
}
同时CI 中 config.php
$config[‘base_url‘] = ‘‘; $config[‘index_page‘] = ‘index.php‘; $config[‘uri_protocol‘] = ‘PATH_INFO‘;
原文:http://my.oschina.net/ren2881971/blog/293938