lilo520 发表于 2011-3-26 17:11:11

加www和不加www跳转不一样

一个VPS、一个IP,两个域名、两个站。
加www和不加www跳转不一样gcstalk.com正常,但是whatao.com跳转gcstalk.com,http://www.whatao.com才正常!求解!
nginx.conf里面的代码如下:
userwww www;worker_processes 1;error_log
/home/wwwlogs/nginx_error.logcrit;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_typeapplication/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_length1k;
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_zonecrawler$binary_remote_addr10m;
                  access_logoff;
               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_passunix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
   }
                                 error_page400 = /400.html;
                                 error_page401 = /401.html;
                                 error_page403 = /403.html;
                                 error_page404 = /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_passunix:/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 编辑 ]

lilo520 发表于 2011-3-26 17:12:44

:) 是哪里没有配置对吗?!!

licess 发表于 2011-3-26 21:51:38

都没有绑定不带www的域名

lilo520 发表于 2011-3-27 16:46:18

回复 3# 的帖子

:)   那么要怎么修改呢?!
为什么gcstalk.com没有加www可以正常跳转,但是whatao.com却跳转了gcstalk.com?!

licess 发表于 2011-3-27 21:06:46

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

lilo520 发表于 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;

licess 发表于 2011-3-28 06:19:43

回复 6# 的帖子

lilo520 发表于 2011-3-29 10:11:38

谢谢现在正常了:)
页: [1]
查看完整版本: 加www和不加www跳转不一样