我在玩Nginx,安装了一个需要重写的cms系统,通常的代码是:
location / { try_files $uri $uri/ @rewrites; }
location @rewrites {
rewrite ^/([^/\.]+)/([^/]+)/([^/]+)/? /index.php?page=$1&id=$2&subpage=$3 last;
rewrite ^/([^/\.]+)/([^/]+)/?$ /index.php?page=$1&id=$2 last;
rewrite ^/([^/\.]+)/?$ /index.php?page=$1 last;
}但是这个CMS我安装在另一个名为testcms的目录中。所以我想这会成功的:
location /testcms {
fastcgi_pass phpcgi;
fastcgi_index index.php;
try_files $uri $uri/ /testcms@rewrites;
}
location /testcms@rewrites {
rewrite ^/([^/\.]+)/([^/]+)/([^/]+)/? /testcms/index.php?page=$1&id=$2&subpage=$3 last;
rewrite ^/([^/\.]+)/([^/]+)/?$ /testcms/index.php?page=$1&id=$2 last;
rewrite ^/([^/\.]+)/?$ /testcms/index.php?page=$1 last;
}但是这会导致一个白色的页面,并且在nginx日志中没有错误。我做错什么了吗?
https://stackoverflow.com/questions/10752710
复制相似问题