problem with vhost

Varix nginx-forum at nginx.us
Fri Nov 13 02:49:24 MSK 2009


hallo,

I have this problem: I can only show domain1 index.html file with browser adress and title.

The domain2 and domain3 show's the index.html of the default index.html file.
But the browser adress and title are OK with IE 8.

With Firefox domain2 and domain3 show's the index.html of the domain1 index.html file.
And also the browser adress and title are OK.

########################
./configure \
  --prefix=/nginx \
  --sbin-path=/nginx/sbin \
  --user=nginx \
  --group=nginx \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_secure_link_module \
  --with-http_stub_status_module \
  --with-debug
  
  
Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1 library is not used
  + using system zlib library

  nginx path prefix: "/nginx"
  nginx binary file: "/nginx/sbin"
  nginx configuration prefix: "/nginx/conf"
  nginx configuration file: "/nginx/conf/nginx.conf"
  nginx pid file: "/nginx/logs/nginx.pid"
  nginx error log file: "/nginx/logs/error.log"
  nginx http access log file: "/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"

###########  
  
xxxxx:/source/nginx/nginx# make install
make -f objs/Makefile install
make[1]: Entering directory `/source/nginx/nginx'
test -d '/nginx' || mkdir -p '/nginx'
test -d '/nginx'                || mkdir -p '/nginx'
test ! -f '/nginx/sbin'                 || mv '/nginx/sbin'                     '/nginx/sbin.old'
cp objs/nginx '/nginx/sbin'
test -d '/nginx/conf'           || mkdir -p '/nginx/conf'
cp conf/koi-win '/nginx/conf'
cp conf/koi-utf '/nginx/conf'
cp conf/win-utf '/nginx/conf'
test -f '/nginx/conf/mime.types'                || cp conf/mime.types '/nginx/conf'
cp conf/mime.types '/nginx/conf/mime.types.default'
test -f '/nginx/conf/fastcgi_params'            || cp conf/fastcgi_params '/nginx/conf'
cp conf/fastcgi_params          '/nginx/conf/fastcgi_params.default'
test -f '/nginx/conf/nginx.conf'                || cp conf/nginx.conf '/nginx/conf/nginx.conf'
cp conf/nginx.conf '/nginx/conf/nginx.conf.default'
test -d '/nginx/logs'           || mkdir -p '/nginx/logs'
test -d '/nginx/logs' ||                mkdir -p '/nginx/logs'
test -d '/nginx/html'           || cp -r html '/nginx'
test -d '/nginx/logs' ||                mkdir -p '/nginx/logs'
make[1]: Leaving directory `/source/nginx/nginx'

#######################

The nginx.conf:


user  nginx nginx;

worker_processes  1;

events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;

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

    #access_log  logs/access.log  main;

    sendfile        on;
    # tcp_nopush      on;
    tcp_nodelay     on;
	
    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types      text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

	Server_token on;
	
	include /nginx/sites-enabled/*;
	
}

###############

The domain default:


server {
    listen       80;
    server_name  localhost;

    location / {
        root   html;
        index  index.html index.htm;
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}
#############

The domain1.com:


server {

            listen   80;
            server_name  domain1.com;
            rewrite ^/(.*) http://www.domain1.com/$1 permanent;
           }

server {
            listen   80;
            server_name www.domain1.com;

            access_log /www/domain1.com/log/access.log;
            error_log /www/domain1.com/log/error.log;

            location / {

                        root   /www/domain1.com/;
                        index  index.html;

                        }

            }
#################

The domain2.com:


server {

            listen   80;
            server_name  domain2.com;
            rewrite ^/(.*) http://www.domain2.com/$1 permanent;

           }

server {

            listen   80;
            server_name www.domain2.com;

            access_log /www/domain2.com/log/access.log;
            error_log /www/domain2.com/log/error.log;

            location / {

                        root   /www/domain2.com/;
                        index  index.html;

                        }

            }
#####################

The domain3.com:
  
  
server {

            listen   80;
            server_name  domain1.com;
            rewrite ^/(.*) http://www.domain1.com/$1 permanent;

           }

server {

            listen   80;
            server_name www.domain3.com;

            access_log /www/domain3.com/log/access.log;
            error_log /www/domain3.com/log/error.log;

            location / {

                        root   /www/domain3.com/;
                        index  index.html;

                        }

            }  
  
#################

Who can help ?

Thanks

Varix

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






More information about the nginx mailing list