Nginx为所有域加载相同的Web

时间:2015-06-23 10:58:51

标签: nginx debian

我在同一台服务器nginx中有两个域名fav2feed.com和elciervonegro.com,我自己设置(新手)。 如果我只在一个域中启用了一个域,那么它们会很好地加载。当我尝试同时在线同时购买时,两个域都加载elciervonegro.com。

以下是我的网站:

fav2feed.com

server {
listen   80; ## listen for ipv4; this line is default and implied
#listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

root /var/www/fav2feed;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name fav2feed.com;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ /index.html;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
}


#error_page 404 /404.html;


# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
#   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
#   # With php5-cgi alone:
#   fastcgi_pass 127.0.0.1:9000;
#   # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#   listen 8000;
#   listen somename:8080;
#   server_name somename alias another.alias;
#   root html;
#   index index.html index.htm;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

elcievonegro.com

    server {
  listen   80; ## listen for ipv4; this line is default and implied
  #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

  root /var/www/elciervonegro;
  index index.php index.html index.htm;

  # Make site accessible from http://localhost/
  server_name elciervonegro.com;

  location / {
  # First attempt to serve request as file, then
  # as directory, then fall back to displaying a 404.
  try_files $uri $uri/ /index.html;
  # Uncomment to enable naxsi on this location
  # include /etc/nginx/naxsi.rules
  }

  location /doc/ {
  alias /usr/share/doc/;
  autoindex on;
  allow 127.0.0.1;
  allow ::1;
  deny all;
  }


  #error_page 404 /404.html;


  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  #
  location ~ \.php$ {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  #
  # # With php5-cgi alone:
  # fastcgi_pass 127.0.0.1:9000;
  # # With php5-fpm:
  fastcgi_pass unix:/var/run/php5-fpm.sock;
  fastcgi_index index.php;
  include fastcgi_params;
  }

}

2 个答案:

答案 0 :(得分:0)

我必须通过在网站上使用默认文件从干净的模板启动安装来修复它,否则无法修复它。

由于

答案 1 :(得分:0)

这也可能是由于fastcgi_pass 127.0.0.1:9000;服务器块中使用相同的nginx(如果将一个域配置复制到另一个)。

如果您在php-fpm中使用不同chroot的{​​{1}}投放,则会显示listen ports为两个域提供同一网站。