以前web用apache的架设thinkphp的程序,但是转为nginx的服务器后,一直不能
正常网站,就是规则重写的问题;
apache的配置:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
RewriteRule ^/?([a-zA-Z0-9]+)$ index.php?app=home&mod=Public&act=error404 [L]
在Nginx的配置是这样的:
location / {
root /wwwroot/mysite;
index index.html index.htm index.php;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~* .php$ {
root /wwwroot/mysite;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$"){
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
看了网上很多有关解决的方案,都不生效,我的Nginx的版本1.4的;如有解答,不胜感激!!!