VPS侦探论坛

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

加www和不加www跳转不一样

[复制链接]
发表于 2011-3-26 17:11:11 | 显示全部楼层 |阅读模式

一个VPS、一个IP,两个域名、两个站。
加www和不加www跳转不一样gcstalk.com正常,但是whatao.com跳转gcstalk.com,http://www.whatao.com才正常!求解!
nginx.conf里面的代码如下:
user  www www;worker_processes 1;error_log  
/home/wwwlogs/nginx_error.log  crit;pid      
  /usr/local/nginx/logs/nginx.pid;#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;events
{
  use epoll;
  worker_connections 51200;
}http
{
  include       mime.types;
  default_type  application/octet-stream;  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 50m;  sendfile on;
  tcp_nopush     on;  keepalive_timeout 60;  tcp_nodelay on;  fastcgi_connect_timeout 600;
  fastcgi_send_timeout 600;
  fastcgi_read_timeout 600;
  fastcgi_buffer_size 256k;
  fastcgi_buffers 16 256k;
  fastcgi_busy_buffers_size 512k;
  fastcgi_temp_file_write_size 512k;
              fastcgi_intercept_errors on;  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 16k;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;  #limit_zone  crawler  $binary_remote_addr  10m;
                    access_log  off;
                 access_log /dev/null;
                 error_log /dev/null;server
{
  listen       80;
  server_name www.gcstalk.com;
  index index.html index.htm index.php;
  root  /home/wwwroot/www.gcstalk.com;
                 include discuzx.conf;
  location ~ .*\.(php|php5)?$
   {
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
   }
                                 error_page  400 = /400.html;
                                 error_page  401 = /401.html;
                                 error_page  403 = /403.html;
                                 error_page  404 = /404.html;  location /status {
   stub_status on;
   access_log   off;
  }  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }  location ~ .*\.(js|css)?$
   {
    expires      12h;
                                 
   }  
}
include vhost/*.conf;
}

================================================================================

vhost里面代码如下:server
{
  listen       80;
  server_name www.whatao.com;
  index index.html index.htm index.php default.html default.htm default.php;
  root  /home/wwwroot/www.whatao.com;  include haodian8.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;
}

[ 本帖最后由 lilo520 于 2011-3-26 17:12 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2011-3-26 17:12:44 | 显示全部楼层


是哪里没有配置对吗?!!
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-3-26 21:51:38 | 显示全部楼层

都没有绑定不带www的域名
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2011-3-27 16:46:18 | 显示全部楼层

回复 3# 的帖子




   那么要怎么修改呢?!
为什么gcstalk.com没有加www可以正常跳转,但是whatao.com却跳转了gcstalk.com?!
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-3-27 21:06:46 | 显示全部楼层

www.gcstalk.com 是主站肯定跳这个,www的不带www的在server段设置里都加上。

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

 楼主| 发表于 2011-3-27 21:43:53 | 显示全部楼层

回复 5# 的帖子


请问是这样吗?!
server
        {
                listen       80;
                server_name whatao.com www.whatao.com;
                index index.html index.htm index.php default.html default.htm default.php;
发表于 2011-3-28 06:19:43 | 显示全部楼层

回复 6# 的帖子


美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2011-3-29 10:11:38 | 显示全部楼层

谢谢  现在正常了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-20 05:47 , Processed in 0.027319 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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