codeigniter框架需要path_info的支持,Apache默认支持path_info,但是nginx默认不支持,我们需要设置nginx,使得nginx支持path_info
网上试了好多方法最总才解决希望对大家有所帮助:(我的mac版的,具体设置看你们的需要,把重点的红色显示)
server {
listen 8080;
server_name localhost;
location / {
# root /usr/local/var/www/;
# index index.html index.htm index.php;
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /wechat/index.php?$1 last;
break;
# rewrite ^/(.*)$ /wechat/index.php/$1 last;
# break; 注意:网上好多是用 index.php/$1 应该是 ? 这个要注意了
}
}
# error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/var/www;
}
location ~ .php$ {
root /usr/local/var/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /.ht {
deny all;
}
}
rewrite or internal redirection cycle while processing "/wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php/server", client: 127.0.0.1, server: localhost, request: "GET /wechat/index.php/server HTTP/1.1", host: "127.0.0.1:8080"
rewrite 重复了10次 并不是 break 的问题
这个问题就是上面说的 / 改为 ? 即可。