aaron 发表于 2010-10-29 14:50:12

discuz的nginx伪静态,安装在虚拟主机根目录下面可以,虚拟主机的文件夹下面不行

安装了老大们提供的lnmp一键安装包,开始设置discuz7.2的伪静态。

添加了一个虚拟主机u.myname.com 这样的,然后在下面建立了一个72的目录来安装discuz7.2,发现在目录下面,不能伪静态,把discuz.conf里面 location那里改成 location /72/ 重启lnmp,也不行。

把论坛从72目录移动到跟目录,伪静态成功,请问哪里有问题呢。

谢谢老大了

wxforex 发表于 2010-10-29 20:25:04

你这样应该不行的 .....   简单的话 你弄个 72.myname.com 绑定到你72的目录才可以
因为伪静态的规则 是按照根目录来设定的

你如果想 用u.myname.com/72 来访问 你得修改伪静态规则

aaron 发表于 2010-10-30 22:48:56

原帖由 wxforex 于 2010-10-29 20:25 发表 https://bbs.vpser.net/images/common/back.gif
你这样应该不行的 .....   简单的话 你弄个 72.myname.com 绑定到你72的目录才可以
因为伪静态的规则 是按照根目录来设定的

你如果想 用u.myname.com/72 来访问 你得修改伪静态规则 ...
看来和apache的还是很不一样啊,那应该怎么修改规则啊,麻烦高手指教一下啊

licess 发表于 2010-10-31 19:17:13

dz的nginx伪静态网上很多,可以搜索一下。
lnmp里面的伪静态是只适合虚拟主机,不适合二级目录的。需要修改伪静态加上二级目录的名称。

aaron 发表于 2010-10-31 21:55:32

原帖由 licess 于 2010-10-31 19:17 发表 https://bbs.vpser.net/images/common/back.gif
dz的nginx伪静态网上很多,可以搜索一下。
lnmp里面的伪静态是只适合虚拟主机,不适合二级目录的。需要修改伪静态加上二级目录的名称。

老大好啊,请问一下二级目录的名称加在哪里呢?

比如这个是虚拟主机的discuz.conf的内容
location / {
            rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
            rewrite ^/forum-(+)-(+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
            rewrite ^/thread-(+)-(+)-(+)\.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;
      }
在这个虚拟主机下面,我的discuz7.2安装在72目录下面的

伪静态这样改对吗?
location /72/ {
            rewrite /72/^/archiver/((fid|tid)-[\w\-]+\.html)$ /72/archiver/index.php?$1 last;
            rewrite /72/^/forum-(+)-(+)\.html$ /72/forumdisplay.php?fid=$1&page=$2 last;
            rewrite /72/^/thread-(+)-(+)-(+)\.html$ /72/viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
            rewrite /72/^/space-(username|uid)-(.+)\.html$ /72/space.php?$1=$2 last;
            rewrite /72/^/tag-(.+)\.html$ /72/tag.php?name=$1 last;
      }

aaron 发表于 2010-10-31 22:11:36

刚才测试了一下,应该这样的,搞定了,呵呵
location / {
            rewrite ^/72/archiver/((fid|tid)-[\w\-]+\.html)$ /72/archiver/index.php?$1 last;
            rewrite ^/72/forum-(+)-(+)\.html$ /72/forumdisplay.php?fid=$1&page=$2 last;
            rewrite ^/72/thread-(+)-(+)-(+)\.html$ /72/viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
            rewrite ^/72/space-(username|uid)-(.+)\.html$ /72/space.php?$1=$2 last;
            rewrite ^/72/tag-(.+)\.html$ /72/tag.php?name=$1 last;
      }

谢谢老大了
页: [1]
查看完整版本: discuz的nginx伪静态,安装在虚拟主机根目录下面可以,虚拟主机的文件夹下面不行