discuz X2.5在nginx下的伪静态(rewrite)配置

2013年3月26日 | 标签:

现配置一个网站bbs.giitu.com 是使用discuz x2.5架起来的 设置了伪静态 特下下面步骤

第一步

去管理员后台开启伪静态 后台->全局->seo设置

第二步

配置nginx文件 具体如下

server {
    listen  80;
    server_name     bbs.giitu.com;
    #access_log      /data/www/phpno_com/logs/access.log main;
    access_log off;
    error_page 404  http://www.giitu.com/404.html;
    #location /404.html {
    #        root /data/www/phpno_com/wwwroot;
    #}

    location /{
        root /data/www/www_giitu_com/bbs_wwwroot;
        index index.html index.htm index.php;
        rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
        rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
        rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
        rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
        rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
        rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
        rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
        rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
        rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
    }

    location ~ \.php$ {
        root           /data/www/www_giitu_com/bbs_wwwroot;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /data/www/www_giitu_com/bbs_wwwroot/$fastcgi_script_name;
        include        fastcgi_params;
    }

}
目前还没有任何评论.


1 + = three