全球主机交流论坛

标题: lnmp无论我那种方式设置conf文件,测速时http状态都是301 [打印本页]

作者: ppmm    时间: 2012-1-9 10:09
标题: lnmp无论我那种方式设置conf文件,测速时http状态都是301
本帖最后由 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;
}
[attach]22893[/attach]
(, 下载次数: 0)
作者: 安迪    时间: 2012-1-9 10:10
技术帝出现。
作者: Andyliu    时间: 2012-1-9 10:56
本帖最后由 Andyliu 于 2012-1-9 11:01 编辑

下面一种是301到WWW

上一种不是。

另外 你确定修改配置后 重启过nginx
作者: ppmm    时间: 2012-1-9 11:05
Andyliu 发表于 2012-1-9 10:56
下面一种是301到WWW

上一种不是。

我重启过lnmp,跟nginx好几次了
所以才觉得见鬼了
同样配置的其它网站没有这个问题
作者: foxconndmd    时间: 2012-1-9 11:09
第二个配置有做301
作者: 闲推月下门    时间: 2012-1-9 11:11
网站目录下的.htaccess文件检查下
作者: javaluo    时间: 2012-1-9 11:43
标题: RE: lnmp无论我那种方式设置conf文件,测速时http状态都是301
闲推月下门 发表于 2012-1-9 11:11
网站目录下的.htaccess文件检查下

nginx不支持的
作者: ppmm    时间: 2012-1-9 12:15
foxconndmd 发表于 2012-1-9 11:09
第二个配置有做301

我知道第二配置有做301,现在的问题是无论那个配置,所有网站都是301;按道理来说,至少第二个配置时只有一个网址是301




欢迎光临 全球主机交流论坛 (https://sunk.eu.org/) Powered by Discuz! X3.4