Home arrow Site Administration arrow Page 4 - Getting More Out Of Apache (Part 1)

Gotcha! - Administration

While the default Apache configuration is good enough for mostWeb applications, there's a lot more under the hood of the planet's mostpopular Web server. In this article, find out how to create virtual hostson a single Web server, and use Server-Side Includes for greaterflexibility in your HTML pages.

TABLE OF CONTENTS:
  1. Getting More Out Of Apache (Part 1)
  2. Virtually Yours
  3. Two Birds With One Host
  4. Gotcha!
  5. Including A Few More Tricks
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 6
January 04, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
There are, however, a couple of gotchas with virtual hosting.

Once you have specified the NameVirtualHost directive, it's important to remember that all the other default settings in your configuration file are null and void. Consequently, if you wish to access the default server "localhost", you will need to include it in the list of virtual hosts.

The second gotcha is the one mentioned a few pages back - clients which do not support HTTP/1.1 will not be able to view virtual hosts correctly. The Apache documentation addresses this problem via the ServerPath directive.

Here's what it would look 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 ServerPath /alpha 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 ServerPath /beta ErrorLog logs/melonfire-beta.com-error_log CustomLog logs/melonfire-beta.com-access_log common </VirtualHost>
How does this work? Very simply - any requests for URLs beginning with the descriptor /alpha will be automatically served from host "melonfire-alpha.com", while URLs beginning with the descriptor /beta will be served from host "melonfire-beta.com".

For more information on this, you should take a look at the Apache documentation, which includes a working example.

 
 
>>> More Site Administration Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 



© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap

Dev Shed Tutorial Topics: