nginx静态规则这样添加为何不行,该如何改 只看楼主

  • 16# zyypp
  • 2009-10-12 22:39:33
把你的那个 改了下 中间的红色的 为你的rewrite 我不知道 对不 所以 也没改
总体 就是这个结构了

server
{
   listen  80;
   server_name  要绑定的域名;
   root  网站目录的绝对路径;

location / {
   rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
   rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
   rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.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;
   break;
   if ($host != 'moltown.com/my' ) {
      rewrite  ^/(.*)$  http://moltown.com/my/$1  permanent;
   }
   rewrite ^/(post|record|sort|author|page)-([0-9]+)\.html$ /index.php?$1=$2;
   rewrite ^/tag-(.+)\.html$ /index.php?tag=$1;

}

location /status {
   stub_status on;
   access_log   off;
}
}
  • 17# mojave
  • 2009-10-12 22:46:26

回复 16# 的帖子

测试下
unexpected end of file, expecting "}" in /usr/local/nginx/conf/nginx.conf:117
configuration file /usr/local/nginx/conf/nginx.conf test failed
说的117也就是最后一行的}
  • 18# zyypp
  • 2009-10-12 22:51:57
你自己自己看下 这两个符号 {  }  是不是有多余的  这个 大括号 要相对应 不能多 和 少
  • 19# mojave
  • 2009-10-12 22:55:18

回复 18# 的帖子

肯定是匹配的才行,今天我改的时候也碰到N次这个问题,我以为小学数学没学好,但是确实是匹配的....
  • 20# zyypp
  • 2009-10-12 23:02:41
你把 配置 贴上来 过着 pm过来
1 ..2345.. 11下一页