开发者社区> 问答> 正文

云服务器如何设置DZ网站伪静态

云服务器
系统:linux
Nginx 1.4.4
hph V5.5.7
在DZ后台得到代码
复制到nginx.conf文件里,
重启
网站启动不了,




Nginx Web Server

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;if (!-e $request_filename) {return 404;}

展开
收起
圈圈驴 2014-12-20 16:27:05 8401 0
4 条回答
写回答
取消 提交回答
  • 估计是伪静态规则错误
    2015-05-26 00:37:04
    赞同 展开评论 打赏
  • Re云服务器如何设置DZ网站伪静态

    2X rewrite 文件 好像已经配置规则    3X没有

    DX3.2 Nginx 1.4.7  为例


    新建 .htaccess文件
    后台,全局,URL 静态化  查看当前的 Rewrite 规则

    Nginx Web Server

    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;
    if (!-e $request_filename) {
            return 404;
    }

    保存

    上传至论坛根目录

    进入服务器后台  CD /server/nginx/conf/vhosts
    修改服务器配置文件
    server {
        listen       80 default;
        server_name  _;
            index index.html index.htm index.php;
            root /www/default;   //   网站根目录
    ------------------------------------------------------------------------
            include /www/default/.htaccess;   //  include .htaccess文件到 网站根目录
    ------------------------------------------------------------------------
            location ~ .*\.(php|php5)?$
            {
                    fastcgi_pass  127.0.0.1:9000;
                    fastcgi_index index.php;
                    include fastcgi.conf;
            }
            location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            {
                    expires 30d;
            }
            location ~ .*\.(js|css)?$
            {
                    expires 1h;
            }
            access_log  /alidata/log/nginx/access/default.log;
    }

    wq 保存退出

    /etc/init.d/nginx reload

    重读服务器

    测试完美
    2015-05-26 00:26:04
    赞同 展开评论 打赏
  • Re云服务器如何设置DZ网站伪静态
    去写工单,售后会告诉你
    2014-12-20 16:50:14
    赞同 展开评论 打赏
  • Re云服务器如何设置DZ网站伪静态
    Nginx Web Server

    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;
    if (!-e $request_filename) {
        return 404;
    }
    2014-12-20 16:32:33
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
如何运维千台以上游戏云服务器 立即下载
网站/服务器取证 实践与挑战 立即下载
ECS计算与存储分离架构实践 立即下载