VPS侦探论坛

 找回密码
 注册
查看: 6209|回复: 7

lnmp无论我那种方式设置conf文件,用工具检测http状态都是301

[复制链接]
发表于 2012-1-9 12:25:43 | 显示全部楼层 |阅读模式

带www跟不带www 的,无论用那个conf文件,测速时都是显示http状态是301,是测速网站错了?还是怎么的,我用了17ce跟webkaka两个都测了;另外我又找了几个检测网站测了http状态还是301,有什么办法解决不?

一种方式的conf:
server
        {
                listen       80;
                server_name www.xxx.com  xxx.com ;
                index index.html index.htm index.php default.html default.htm default.php;
                root  /home/wwwroot/111;

                include none.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;
        }

另一种方式的:
server
        {
                listen       80;
                server_name www.xxx.com;
                index index.html index.htm index.php default.html default.htm default.php;
                root  /home/wwwroot/111;

                include none.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;
        }
server {
server_name xxx.com;
rewrite ^(.*) http://www.xxx.com$1 permanent;
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-1-9 12:53:32 | 显示全部楼层


第一种不会301,第二种会301

你测试/usr/local/nginx/sbin/nginx -t  测试看看
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-1-9 14:36:10 | 显示全部楼层

回复 2# 的帖子


军哥,按道理来说,第一种应该是两个都不是301;第二种应该只有一个网站是301,对吧?现在我的情况是,无论用那一种,都是两个网站都是301
所以才觉得见鬼了

我测试/usr/local/nginx/sbin/nginx -t  了,提示是successfully
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-1-9 17:15:41 | 显示全部楼层

回复 3# 的帖子




的确怪诡异
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-1-9 21:16:02 | 显示全部楼层

回复 4# 的帖子


我删掉conf文件,再重新建站,还是那样,郁闷噢
不知道会不会影响seo
我自己到是可以访问,就是测试全是301

军哥运维代购:http://shop63846532.taobao.com/

发表于 2012-1-10 18:42:19 | 显示全部楼层

回复 5# 的帖子


你用的 DZX吗 ,DZX后台要设置 默认域名  ,否则默认情况下 首页会 301
发表于 2012-1-13 14:15:08 | 显示全部楼层

DZX自带301的,不用设置的
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-1-13 19:27:16 | 显示全部楼层

楼主是不是把网站目录放在WWWROOT下,你放在WWWROOT的平级目录试试,我的也是这样,不管配置是什么都301,但是方在WWROOT平级目录下的就没有这样的情况
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-22 03:55 , Processed in 0.028494 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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