阅读771 返回首页    go 技术社区[云栖]


护卫神·Nginx大师面板上如何设置伪静态

许多客户在使用护卫神·Nginx大师创建网站后,因SEO要求,可能需要使用伪静态功能,在这里护卫神就大体说一下如何设置伪静态。
本例以安装wordpress博客程序后设置伪静态;
一、先打开桌面上的“护卫神·Nginx大师”,右键点击要设置伪静态的网站,打开“修改网站”菜单,如下图所示
1
2

二、勾选 “启用伪静态”,同时点击打开“编辑规则”,在这里复制wordpress在NGINX下的伪静态规则,如下图所示
3
4

“确定”,保存好后,护卫神·Nginx大师会自动重启服务

三,打开wordpress后台,在WP后台 > 设置 > 固定链接,设置为 非默认的即可,如下图
5

注意事项:
伪静态规则需要正确的符合NGINX的规则,如果你不会编写,请联系程序商那边索取。如果这里的规则不正确,保存后将可能导致NGINX无法正常启动,从而造成网站无法访问。
DISCUZ_X3.4论坛的NGINX伪静态规则:
```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/archiver/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;
}




WORDPRESS博客程序伪静态规则:
```location / {
if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
        }
if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
        }
if (!-f $request_filename){
                rewrite (.*) /index.php;
        }
}

护卫神Nginx环境镜像(Win2012_64位|PHP|Nginx)
https://market.aliyun.com/products/56368007/cmjj015091.html

护卫神Nginx环境镜像(Win2008_64位|PHP|Nginx)
https://market.aliyun.com/products/56368007/cmjj014993.html

最后更新:2017-09-06 18:32:43

  上一篇:go  AliCloud Duplicity
  下一篇:go  云栖虾米音乐节10月11日阵容大揭秘