7.4. Creating Virtual Web Servers

7.4. Creating Virtual Web Servers

It is possible to have one physical Web server run more than one virtual Web servers, for example, www.your_name.com and www.your_company.com These are two different Web sites, but they are located on one server. This arrangement offers the following advantages:

  • Savings on hardware.

  • Efficient use of the communication channels for small sites and low server loads.

  • Savings on IP addresses. Available IP addresses would have long been exhausted if a separate IP address were used for each individual Web site. (Although once the IPv6 protocol is in place, this problem will be less important.) Virtual Web servers can be IP-based or name-based. IP-based virtual hosts are addressed by individual IP addresses. Name -based virtual hosts share the same IP address and are addressed using individual host names .

  • Simplified administration and security control. It is a rather complex process to configure and secure a Web server; consequently, it is much easier to configure and update software of one physical server than of hundreds of servers.

    A virtual server is created by the following directive block:

     <VirtualHost address:port> </VirtualHost> 

The parameters of the virtual server are specified between these tags. For example, the following is a description for a virtual server that uses address 192.168.1.1 and port 80:

 <VirtualHost 192.168.1.1:80>     ServerAdmin admin@your_server.com     DocumentRoot /var/www/your_server     ServerName your_server.com     ErrorLog logs/your_server.com -error_log     CustomLog logs/your_server.com -access_log common    <Directory /var/www/your_server/>        AllowOverride none    </Directory> </VirtualHost> 

I will consider only the main parameters used to describe a virtual server. These are the following:

  • ServerAdmin The email of the administrator to send error messages to.

  • DocumentRoot The site's root directory, from which files will be served .

  • ServerName Self-explanatory. If no server name is specified, the server's local IP address is used.

The ErrorLog and CustomLog directives have already been considered . They are followed in the example by specifying access rights to the /var/www/your_server/ directory, which is the root directory of the virtual Web server. Permissions can be set both within the virtual server declaration block and outside of it.

More detailed information can be found in the Apache server documentation.



Hacker Linux Uncovered
Hacker Linux Uncovered
ISBN: 1931769508
EAN: 2147483647
Year: 2004
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net