Возникла следующая проблема.
Имеется два домена. Один из которых используется с поддоменами.
пример:
Первый домен: domain1.ru с поддоменами sub.domen1.ru, sub2.domain.ru
Второй домен: domain2.ru
Так вот, для первого домена и его поддоменов весь трафик проксируется и все работает как нужно. Однако, для второго домена nginx отказывается обрабатывать какие-либо директивы и выбрасывает default сайт.
vhost от apache выкладывать не буду, нет смысла, до него дело не доходит.
Конфиг nginx следующий:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 512;
sendfile on;
keepalive_timeout 0;
server {
listen 80 default;
server_name _;
access_log off;
error_log off;
return 444;
}
server {
listen 80;
server_name domain1.ru www.domain1.ru;
charset utf-8;
keepalive_timeout 65;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
location / {
proxy_pass http://127.0.0.1:9999;
proxy_redirect off;
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 1s;
proxy_send_timeout 10s;
proxy_intercept_errors off;
proxy_buffer_size 4k;
proxy_buffers 8 64k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 10m;
proxy_read_timeout 120s;
}
location ~* \.(jpg|jpeg|gif|png|bmp|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|js|swf|mp3|woff)$ {
root C:/WEB/Apache24/htdocs/domain1.ru;
expires 168h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~ /\.ht { deny all; }
error_page 500 /500.html;
location = /500.html {
root C:/WEB/Apache24/htdocs/error_pages;
}
error_page 502 /502.html;
location = /502.html {
root C:/WEB/Apache24/htdocs/error_pages;
}
error_page 503 /503.html;
location = /503.html {
root C:/WEB/Apache24/htdocs/error_pages;
}
error_page 504 /504.html;
location = /504.html {
root C:/WEB/Apache24/htdocs/error_pages;
}
}
server {
listen 80;
server_name sub.domain1.ru;
charset utf-8;
location / {
proxy_pass http://127.0.0.1:9999;
proxy_redirect off;
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 1s;
proxy_send_timeout 10s;
proxy_intercept_errors off;
proxy_buffer_size 4k;
proxy_buffers 8 64k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 10m;
proxy_read_timeout 120s;
}
location ~* \.(jpg|jpeg|gif|png|bmp|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|js|swf|mp3|woff)$ {
root C:/WEB/Apache24/htdocs/sub.domain1.ru;
expires 168h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~ /\.ht { deny all; }
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name www.domain2.ru domain2.ru;
charset utf-8;
access_log C:/WEB/nginx/logs/domain2.ru_access.log;
error_log C:/WEB/nginx/logs/domain2.ru_error.log;
location / {
proxy_pass http://127.0.0.1:9999;
proxy_redirect off;
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 1s;
proxy_send_timeout 10s;
proxy_intercept_errors off;
proxy_temp_file_write_size 10m;
proxy_read_timeout 900s;
proxy_buffering off;
}
location ~* \.(jpg|jpeg|gif|png|bmp|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|js|swf|mp3|woff)$ {
root C:/WEB/Apache24/htdocs/domain2.ru;
expires 168h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~ /\.ht { deny all; }
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Заранее спасибо за помощь!