marcosscriven Posted December 20, 2006 Share Posted December 20, 2006 HiI want to be able to add/update/remove virtual hosts dynamically, without restarting Apache 2 every time. My main reason being, I don't want any down time.I found this tutorial, which is reasonably clear: http://httpd.apache.org/docs/2.0/vhosts/mass.htmlWhat isn't clear to me is the following:1) If I have virtual hosts www.example1.com and www.example2.com, what happens if I want to do some maintenance work on www.example2.com, such that they just get a page saying 'Maintenance underway blah blah blah', and can't request any other pages?2) How can I ensure that if the virtual host doesn't exist or has a problem, the default one isn't used3) How can I, dynamically, choose whether or not a site should be plain text over port 80, or secured over 445?Just to clarify, what I would like to be able to do is setup any virtual host I wanted, without bouncing the Apache2 process, just by setting up the relevant DNS records, and creating a directory in /var/www/ of the same name, while also being able to determine it's status as SSL or not, and whether it is 'up' or 'down'I have found a few MODs in Google searches that seem to use MySQL setups, but they seem to be invariably home brew stuff that is not very up to date.ThanksMarcos Quote Link to comment Share on other sites More sharing options...
steviewdr Posted December 21, 2006 Share Posted December 21, 2006 [quote]3) How can I, dynamically, choose whether or not a site should be plain text over port 80, or secured over 445?[/quote]In a .htaccess file, put:[code]SSLRequireSSLErrorDocument 403 https://www.securewebsite.com/[/code]Its only a quick hack.[quote]1) If I have virtual hosts www.example1.com and www.example2.com, what happens if I want to do some maintenance work on www.example2.com, such that they just get a page saying 'Maintenance underway blah blah blah', and can't request any other pages?[/quote]There are custom error codes you can put in a .htaccess file in the root web folder of www.example2.com[quote]2) How can I ensure that if the virtual host doesn't exist or has a problem, the default one isn't used[/quote]I dont get you there. Do you just want to throw a 404 - Page Not Found? if a virtual host aint exist.Im sure there is a default page you can use for apache to show if the server is accessed by default, e.g. by IP address or a unconfigured sub-domain name.-steve Quote Link to comment Share on other sites More sharing options...
the_oliver Posted January 1, 2007 Share Posted January 1, 2007 If you comment out the default page at the top of the virtual hosts part of the config (part 3) then this will not be a problem, so long as your using name based hosting. If your using ip based hosting then it may do a revers lookup on service ip, and show you that page, but it depend how your distributing your ips.As to the ssl or normal, i do it by setting up the following. each site has a folder: www.example.com. With in this they also have to have three other folders docs (for standard on port 80) https (for ssl). Thus when the user starts by typing https:// they hit the https folder other wise the docs folder. My third folder is there cgi-bin.Im assuming your using mod_vhost_alias and something like [i]VirtualDocumentRoot /var/www/html/%0/docs[/i] to achive this? How many sites are you hosting? There are a number of other way to do this that, if your not hosting a huge number of sites may be simpler for what you want! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.