nginx下UCH和DZ的rewrite规则

这个是bbs的

      server
      {
      listen 80;
      server_name bbs.aiyobaby.com;
      index index.html index.htm index.php;
      root /home/aiyobaby/web/bbs;

#limit_conn crawler 20;

location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}

location / {
rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
break;
}

复制代码

这个是home的

      server
      {
      listen 80;
      server_name home.aiyobaby.com;
      index index.html index.htm index.php;
      root /home/aiyobaby/web/home;

#limit_conn crawler 20;

location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}

#UCHome Rewrite Rule
rewrite (space|network)\-(.+)\.html$ /$1.php?rewrite=$2 last;
rewrite (space|network)\.html$ /$1.php last;
rewrite ([0-9]+)$ /space.php?uid=$1 last;
break;

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

复制代码

=======================================
目前测试没有任何问题,可以访问 www.aiyobaby.com 哎哟宝贝亲子网,

关于nginx图片防止盗链
可以参考我的
http://www.discuz.net/viewthread … amp;highlight=nginx

nginx下真正的图片防治盗链。

One thought on “nginx下UCH和DZ的rewrite规则

Comments are closed.