reverse proxy - several virtual host - same proxy pass ip - getting wrong content

Pekka.Panula at Pekka.Panula at
Wed Mar 24 12:34:32 MSK 2010


I am using nginx as reverse proxy and i have several names pointing to 
reverse proxy and i am using proxy cache. My backends are basic LAMP 
servers and IBM Lotus Domino servers.

Just wondering whats wrong as i changed domain to point my new nginx 
server and i am getting wrong content, i am getting wrong virtual host 
index page.

eg. i am trying to and i am getting content from they reside same LAMP-server. Looking my nginx 
configuration i cant find anything wrong.
both named points to new nginx reverse proxy server. nginx version 0.7.65

Here is example from my config:

my main config, main parts:
http {
    proxy_cache_path  /usr/share/nginx/cache  levels=1:2 keys_zone=one:10m 
    proxy_temp_path   /usr/share/nginx/tmp;

    proxy_cache_valid 200 302 5m;
    proxy_cache_valid 301 1h;
    proxy_cache_valid any 1m;

     proxy_cache one;

   gzip_http_version 1.1;
   gzip_vary          on;
   gzip_min_length  1100;
   gzip_buffers     16 8k;
   gzip_disable "MSIE [1-6]\.(?!.*SV1)";
   gzip_proxied     any;
   gzip_types       text/css text/plain application/atom+xml 
application/x-javascript application/xml text/javascript 
   gzip on;

   server_tokens off;
   client_header_timeout  3m;
   send_timeout           3m;
   client_header_buffer_size    1k;
   large_client_header_buffers  4 4k;
   output_buffers   1 32k;
   postpone_output  1460;
   sendfile         on;
   tcp_nopush       on;
   tcp_nodelay      on;
   keepalive_timeout  75 20;
   server_names_hash_bucket_size 128; # this seems to be required for some 

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

   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;
   proxy_connect_timeout 90;
   proxy_send_timeout    90;
   proxy_read_timeout    90;

   # default virtual host
    server {
        listen          80 default;
        server_name     _;

        access_log  /var/log/nginx/default-access.log  main;

        server_name_in_redirect  off;

        location / {
            index index.html;
            root  /var/www/default/htdocs;

   # here resides my virtual host configurations
   include /etc/nginx/virtual-hosts/*;


and my virtual hosts under: /etc/nginx/virtual-hosts -directory:

they all look like this:
# redirect ->
server {
   rewrite     ^/(.*)$$1 permanent;

server {
/somedirectory/ combined;
   default_type text/html;
   root         /usr/share/nginx/huolto;

   location / {


      # manual maintenance window
      include /etc/nginx/maintenance.conf;

   # custom errorpages
   include /etc/nginx/errorpages.conf;

   # general block rules, security rules, etc
   include /etc/nginx/suojaus.conf;
And other virtual host like looks like that, except name 
and access log changed. 

How come when trying to load i am getting 
content, mainly index page comes from wrong site.

Looking backend logs i cant find error there, nothing has changed there, 
name based virtual host there, Apache v2.

   Pekka Panula, Sofor Oy - Jatkuvat palvelut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list