problem with setting Virtual Hosts

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

i need help :(

I wrote as the following site.

here is my nginx.conf

user  www www;
worker_processes 1;
error_log  /data/logs/nginx_error.log  crit;
pid        /opt/webserver/nginx/;
#Specifies the value for maximum file descriptors that can be opened by
this process. 
worker_rlimit_nofile 65535;
  use epoll;
  worker_connections 65535;
  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
  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

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

  root /data/www/$host/;

  error_page 404 errors/404.html;
  access_log logs/;

  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

  location ~ /\.ht {
    deny  all;


when i vist

but the website redirect to the following site.


Posted at Nginx Forum:,185203,185203#msg-185203

More information about the nginx mailing list