全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
楼主: 白龙君

[nginx] 301重定向问题

[复制链接]
发表于 2010-5-30 12:14:59 | 显示全部楼层
泥滴代码 ... 摆错位置辣~
 楼主| 发表于 2010-5-30 12:17:09 | 显示全部楼层
QQ截图未命名.png (3.65 KB, 下载次数: 4)
 楼主| 发表于 2010-5-30 12:18:53 | 显示全部楼层
原帖由 Showfom 于 2010-5-30 12:13 发表
/usr/local/nginx/conf/vhost

nginx.conf 里 有

include vhost/*.conf ;

吗?

有的
发表于 2010-5-30 12:24:19 | 显示全部楼层
这样摆放才是正确滴~
server
        {
                listen       80;
                server_name bailongjun.com www.bailongjun.com;
                if ($host != 'bailongjun.com' ) {
                rewrite ^/(.*)$ www.bailongjun.com$1 permanent;
                        }
                index index.html index.htm index.php default.html default.htm default.php;
                root  /home/wwwroot/bailongjun;

                include emlog.conf;

                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }

                access_log off;
        }
 楼主| 发表于 2010-5-30 12:31:40 | 显示全部楼层
原帖由 bluesky 于 2010-5-30 12:24 发表
这样摆放才是正确滴~

按照你的方法网站彻底打不开了
发表于 2010-5-30 12:32:25 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2010-5-30 12:34:22 | 显示全部楼层
原帖由 youland 于 2010-5-30 12:32 发表
http://www.acyoo.com/?p=148

看这里

晕这个我很早都尝试了,不行
发表于 2010-5-30 12:35:25 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2010-5-30 12:37:24 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2010-5-30 12:44:41 | 显示全部楼层
原帖由 youland 于 2010-5-30 12:37 发表
server
        {
                listen       80;
                server_name www.bailongjun.com;
                index index.html index.htm index.php default.html default.htm default.php;
            ...
  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name bailongjun.com www.bailongjun.com;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 root  /home/wwwroot/bailongjun;

  7.                 include emlog.conf;

  8.                 location ~ .*\.(php|php5)?$
  9.                         {
  10.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  11.                                 fastcgi_index index.php;
  12.                                 include fcgi.conf;
  13.                         }

  14.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  15.                         {
  16.                                 expires      30d;
  17.                         }

  18.                 location ~ .*\.(js|css)?$
  19.                         {
  20.                                 expires      12h;
  21.                         }

  22.                 access_log off;
  23.         }
  24. server {
  25. server_name bailongjun.com ;
  26. rewrite ^(.*) http://www.bailongjun.com$1 permanent;
  27. }
复制代码
奇怪了,我原来是这样写的和你的一样啊,用你的覆盖一边却可以,我的缺不行

[ 本帖最后由 白龙君 于 2010-5-30 13:20 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-16 18:42 , Processed in 0.068814 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表