Tuesday 5 February 2013

Stage 3 - Setup Multiple Virtual Hosts on NginX

This configuration works with multiple virtual hosts, and allows the images for all pages to be in an images directory.

worker_processes  2;    # One for each CPU core
error_log logs/main_error.log;
pid        logs/nginx.pid;
events { worker_connections 1024; }

http 
 { include        mime.types;  
   # i.e. On Windows, [<nginx>/conf/]mime.types
   # i.e. the mime.types file in the conf dir in the nginx's directory

   default_type   application/octet-stream;

   index index.htm index.html index.st index.php;
   # the file provided when a client asks for a directory

   server    #default
    { server_name :80;
      access_log logs/catchall.access.log;
      error_log logs/catchall.error.log;
      root html\catchall;
    }

   server    #Server_1
    { server_name
Server_1.uk.to ; # *.Server_1.uk.to;
      access_log logs/
Server_1.access.log;
      error_log logs/
Server_1.error.log;
      root html/
Server_1/currentSite;
      location ^~ /images/ { alias html/
Server_1/images/; }
    }

   server    #
Server_2
    { server_name Server_2.uk.to ; # *.Server_2.uk.to;
      access_log logs/
Server_2.access.log;
      error_log logs/
Server_2.error.log;
      root html/
Server_2/currentSite;
      location ^~ /images/ { alias html/
Server_2/images/; }
    }
 }



No comments: