nginx 1.0.4 и virtual hosts

t0rik nginx-forum на nginx.us
Вт Авг 9 08:32:11 UTC 2011


есть вот такой конфиг,в апаче виртуалки
настроены и работают.

user  www;
worker_processes  2;

events {
    worker_connections  512;
    }

    http {
    include       /usr/local/etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] $status
'
                      '"$request" $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "http_x_forwarded_for"';

#access_log on;
#error_log on;
    access_log  /var/log/nginix/access.log;
    error_log  /var/log/nginix/nginx-error.log notice;

    sendfile       on;
    tcp_nopush     on;
    tcp_nodelay    on;

   server {
   listen       80;
  server_name  domain1 www.domain1;

  # Main location
  location / {
  proxy_pass   http://127.0.0.1:81;
  proxy_redirect default;
  proxy_set_header   Host $host;
  proxy_set_header   X-Real-IP        $remote_addr;
  proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
  client_max_body_size       10m;
  client_body_buffer_size    128k;
  proxy_connect_timeout      90;
  proxy_send_timeout         90;
  proxy_read_timeout         90;
  proxy_buffer_size          32k;
  proxy_buffers              4 32k;
  proxy_busy_buffers_size    64k;
  proxy_temp_file_write_size 64k;
 proxy_max_temp_file_size 0;

  }
  # Static files location
  location ~*
^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$
{
        access_log   off;
        expires      30d;

  root   /disk2/www/domain1;
  }
  }

  server {
  listen 80;
  server_name domain2 www.domain2;
  location / {
  proxy_pass         http://127.0.0.1:81/;
  proxy_redirect
  proxy_set_header   Host;
  proxy_set_header   X-Real-IP        $remote_addr;
  proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
  client_max_body_size       10m;
  client_body_buffer_size    128k;
  proxy_connect_timeout      90;
  proxy_send_timeout         90;
  proxy_read_timeout         90;
  proxy_buffer_size          32k;
  proxy_buffers              4 32k;
  proxy_busy_buffers_size    64k;
  proxy_temp_file_write_size 64k;
  }
  # Static files location
  location ~*
^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$
{
        access_log   off;
        expires      30d;
  root   /disk2/www/domain2;

  }
  }

  }


но при заходе на domain2 грузится domain1.
подскажите пожалуйста в чем может быть
проблема?

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,213561,213561#msg-213561



Подробная информация о списке рассылки nginx-ru