全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 1683|回复: 7
打印 上一主题 下一主题

lnmp无论我那种方式设置conf文件,测速时http状态都是301

[复制链接]
跳转到指定楼层
1#
发表于 2012-1-9 10:09:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 ppmm 于 2012-1-9 10:11 编辑

带www跟不带www 的,无论用那个conf文件,测速时都是显示http状态是301,是测速网站错了?还是怎么的,我用了17ce跟webkaka两个都测了

一种方式的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;
}

QQ截图20120109095933.jpg (27.51 KB, 下载次数: 0)
2#
发表于 2012-1-9 10:10:46 | 只看该作者
技术帝出现。
3#
发表于 2012-1-9 10:56:59 | 只看该作者
本帖最后由 Andyliu 于 2012-1-9 11:01 编辑

下面一种是301到WWW

上一种不是。

另外 你确定修改配置后 重启过nginx
4#
 楼主| 发表于 2012-1-9 11:05:46 | 只看该作者
Andyliu 发表于 2012-1-9 10:56
下面一种是301到WWW

上一种不是。

我重启过lnmp,跟nginx好几次了
所以才觉得见鬼了
同样配置的其它网站没有这个问题
5#
发表于 2012-1-9 11:09:32 | 只看该作者
第二个配置有做301
6#
发表于 2012-1-9 11:11:48 | 只看该作者
网站目录下的.htaccess文件检查下
7#
发表于 2012-1-9 11:43:51 | 只看该作者

RE: lnmp无论我那种方式设置conf文件,测速时http状态都是301

闲推月下门 发表于 2012-1-9 11:11
网站目录下的.htaccess文件检查下

nginx不支持的
8#
 楼主| 发表于 2012-1-9 12:15:55 | 只看该作者
foxconndmd 发表于 2012-1-9 11:09
第二个配置有做301

我知道第二配置有做301,现在的问题是无论那个配置,所有网站都是301;按道理来说,至少第二个配置时只有一个网址是301
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-12-20 04:35 , Processed in 0.114641 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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