// you’re reading...

Software Projects

Webmin Virtual Host Manager

**UPDATE**

Dead project, leaving this be for historical purposes. Webmin has perfectly good vhost capabilities now.

Update
Now requires the perl module YAML. Why? I moved to a new host and the Storable data was not byte compatible. YAML is a nice way to represent data structures in a portable, parsable and human readable way. It was a 4 line change and it made my life easier. It’ll make your easier as well. Ok, maybe not, but it works better this way, trust me:)

Download the 1.1 Version that requires YAML


Download the 1.0 Version that requires Storable



There are about 4,353.32 Virtual Host tools for webmin so of course I had to write my own! What does mine do differently?

  • It uses Apache mod_vhost_alias to simplify deployment and management of sites.
  • It automatically gives each domain a restricted FTP account using Pure FTP
  • It supports unlimited alias per virtual host.
  • Everything is managed via the Webmin interface

I use this to support ~100 virtual sites on a server and it has really freed up my time in a significant way. Mod_Vhost_Alias is highly recommended, its a nice way to have virtual sites created by simply creating a directory. When apache gets the request it checks for a directory using the hostname (www.crackcocaine.com for example). If it finds it then a vhost is dynamically created with that as the DocumentRoot.

Currently tested on Linux and FreeBSD with no issues, its just perl after all!

Read on for details

All you need to do to get this to work is :

  • Install Pure FTP and configure it for Virtual Users (follow Pure FTP docs)
  • Install Apache with mod_vhost_alias (follow Apache Docs)
  • Create a dynamic vhost that looks like this (change items in bold). Note, you can add whatever options you wish enabled for the Vhost in this config file. Things like server-side includes etc.
UseCanonicalName Off VirtualDocumentRoot /path/to/your/vhosts/%0
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\"" vhost_common
CustomLog /path/to/your/weblogs/VHOST_ACCESS vhost_common
ErrorLog /path/to/your/weblogs/VHOST_ERROR   /path/to/your/vhosts/*>
AllowOverride All
Options All
  • Load the vhost.wbm into webmin. It will appear within ‘Others’, you can move it where you want it.
  • Configure the module by telling it
    • Where to store its virtual host database (text file writable by webserver)
    • What the webserver username is (for directory creation)
    • Where the PureFTP user file is (for ftp login updates)
    • The mod_vhost root from the apache config file (to create the new directories)
  • Voila! Thats it, create a virtualhost and try it out. You’ll need to map your DNS entries to the IP of your vhost of course :)

You can install it directly from webmin from from this link : Virtual Host Manager
Any questions? Drop me an email or make a comment. Let me know if you use it, I am always curious!

Discussion

Comments are disallowed for this post.

Comments are closed.