Logo         Community
  Trog
Services
The Company
Community
Columns
Your Account
Contact Us
 
 
Getting More Out Of Apache (part 1)
Learn to use server-side includes and Apache's virtual hosting features.

| Two Birds With One Host |

Here's what the final product looks like:


# host setting for melonfire-alpha.com
<VirtualHost 127.0.0.1>
    ServerAdmin webmaster@melonfire-alpha.com
    DocumentRoot /www/melonfire-alpha.com
    ServerName melonfire-alpha.com
    ErrorLog logs/melonfire-alpha.com-error_log
    CustomLog logs/melonfire-alpha.com-access_log common
</VirtualHost>

# host setting for melonfire-beta.com
<VirtualHost 127.0.0.1>
    ServerAdmin webmaster@melonfire-beta.com
    DocumentRoot /www/melonfire-beta.com
    ServerName melonfire-beta.com
    ErrorLog logs/melonfire-beta.com-error_log
    CustomLog logs/melonfire-beta.com-access_log common
</VirtualHost>


And you can test it by restarting the Apache server and pointing your browser to the Web sites http://melonfire-alpha.com and http://melonfire-beta.com (note that you may need to update your DNS tables as well for this to work).

On the assumption that you have created HTML files for each host and stored them in the locations you've specified for the DocumentRoot directive, Apache should display the appropriate index page for each server. And if you take a look at the log files, you should see separate log files for each virtual host.

As you might imagine, the ability to host multiple Web sites on a single server is an elegant - and economical - solution to the problem of limited IP address range in the IPv4 protocol. It also allows Web hosting services to "sub-host" multiple client domains on a single server, and developers to run multiple Web sites on their development and test systems for simulation purposes.


How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.

Read more, or grab your copy now!


previous page more like this  print this article  next page
 
Search...
 
In trog...
Logging With PHP
Building A Quick-And-Dirty PHP/MySQL Publishing System
Output Buffering With PHP
Date/Time Processing With PHP
Creating Web Calendars With The PEAR Calendar Class
more...
 
In the hitg report...
Crime Scenes
Animal Attraction
Lord Of The Strings
more...
 
In boombox...
Patience - George Michael
Think Tank - Blur
My Private Nation - Train
more...
 
In colophon...
Hostage - Robert Crais
The Dead Heart - Douglas Kennedy
Right As Rain - George Pelecanos
more...
 
In cut!...
American Chai
The Core
Possession
more...
 
Find out how you can use this article on your own Web site!


Copyright © 1998-2018 Melonfire. All rights reserved
Terms and Conditions | Feedback