problem with setting Virtual Hosts

chatfeed nginx-forum at nginx.us
Wed Mar 23 20:16:14 MSK 2011


i need help :(


I wrote as the following site.

http://wiki.nginx.org/VirtualHostExample

here is my nginx.conf



user  www www;
worker_processes 1;
error_log  /data/logs/nginx_error.log  crit;
pid        /opt/webserver/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by
this process. 
worker_rlimit_nofile 65535;
events
{
  use epoll;
  worker_connections 65535;
}
http
{
  include       mime.types;
  default_type  application/octet-stream;

  #charset  gb2312;

  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 8m;

  sendfile on;
  tcp_nopush     on;

  keepalive_timeout 60;

  tcp_nodelay on;

  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;

  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 16k;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css
application/xml;
  gzip_vary on;
  server {
    listen 80 default;
    server_name _;
    access_log logs/default.access.log;

    server_name_in_redirect off;

    root  /data/www;
  }
  #limit_zone  crawler  $binary_remote_addr  10m;
server {
  # Replace this port with the right one for your requirements
  listen 80;  #could also be 1.2.3.4:80

  # Multiple hostnames separated by spaces.  Replace these as well.
  server_name star.domain.com *.domain.com; # Alternately: _

  root /data/www/$host/;

  error_page 404 errors/404.html;
  access_log logs/star.domain.com.access.log;

  index index.php index.html index.htm;

  # serve static files directly
  location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
    access_log off;
    expires max;
  }

  location ~ \.php$ {
    fastcgi_intercept_errors on;
    # By all means use a different server for the fcgi processes if you
need to
    fastcgi_pass   127.0.0.1:9000;
  }

  location ~ /\.ht {
    deny  all;
  }
}

}





when i vist  a.domain.com

but the website redirect to the following site.

http://a.domaincom/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/404.html

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




More information about the nginx mailing list