VPS侦探论坛

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

做301后出现的conflicting server name错误

[复制链接]
发表于 2012-2-21 11:07:01 | 显示全部楼层 |阅读模式

之前运行正常,后来加了301设置,就是把 taaa.com转到了www.taaa.com ,不知道是不是设置的有问题,error.log中会出现下面的错误,但能正常跳转。请高手指点一下,谢谢!

error.log 错误提示:

[warn] 18540#0: conflicting server name "www.taaa.com" on 0.0.0.0:80, ignored


下面是全部的主机conf文件。

  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name www.taaa.com taaa.com;
  5.                 if ($host != 'www.taaa.com' ) {
  6.                         rewrite ^/(.*)$ http://www.taaa.com/$1 permanent;
  7.                         }
  8.                 index index.html index.htm index.php default.html default.htm default.php;
  9.                 root  /home/wwwroot/www.taaa.com;

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

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

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

  25.                 access_log /home/wwwlogs/taaa.log;
  26.                 error_page 404 /404.html;
  27.         }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-2-21 12:31:58 | 显示全部楼层


这个域名添加了2次。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-2-21 13:53:20 | 显示全部楼层

知道提示域名重复,请问该怎么修改呢?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-2-21 15:06:57 | 显示全部楼层



把重复的删了就行了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-2-21 21:52:31 | 显示全部楼层

大哥啊,关键是不知道哪一句是重复的啊。
删的不对重启马上停机,所有网站都打不开。

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

发表于 2012-2-22 08:50:13 | 显示全部楼层

添加了2次虚拟主机!找到多添加的配置文件删了就行了
 楼主| 发表于 2012-2-22 13:58:47 | 显示全部楼层

好像不是添加了虚拟主机的问题。虚拟主机同域名的没有的。
是因为更改了这个conf文件,做了301转向,马上就出现这样的错误。两个不同的虚拟主机都是这样。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-4-9 08:50:35 | 显示全部楼层

改成这样试试?
if ($host = 'taaa.com' ) {

                        rewrite ^/(.*)$ http://www.taaa.com/$1
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-22 17:31 , Processed in 0.027828 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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