云服务器如何设置DZ网站伪静态
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
重读服务器
测试完美
赞0
踩0