越来越多的人把apache转到nginx,对于运行php来说,转移比较容易些。 但要实现伪静态,rewrite配置就会复杂一些,大多数人的问题都出在这里。 下面是nginx下discuz url rewrite配置模板,供大家参考。 注意:修改server_name,root为你的实际配置。
其它常见rewrite nginx cakephp rewrite规则 server { listen 80; server_name www.264.cn; root /usr/local/nginx/html/kdw location / { index index.html index.htm index.php; rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last; rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last; rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last; rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last; rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last; rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last; } location ~ \.php$ { include fastcgi_params; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } (责任编辑:IT) |