Now that I have my own domain with the ability to use subdomains, I would rather be able to access Webmin via a subdomain of my site, rather than by forwarding an additional port number, like 10000, which Webmin uses by default.

Because of the fact the Webmin?s built-in web server doesn?t support subdomains, and because WordPress MU requires all the subdomains to be forwarded to it by a wildcard for the sake of sanity, I decided the only way to retain my head and serve Webmin over a subdomain would be to use Apache (and Virtual Hosts) as a mediator.

After Googling for a while, I found two options for doing this, and each seemed equally as appealing:

  • Using Virtual Hosts on Apache and serving Webmin via CGI.
  • Using Virtual Hosts on Apache and serving Webmin via mod_proxy.

My first attempt was to set up Webmin via CGI. I first followed setup instructions from the Webmin website, but whenever I tried to access Webmin, it would half-display the page, and bomb out with some error. After some tweaking, I gave up and decided to try out mod_proxy.

mod_proxy is an Apache module that does as its name suggests: acts as a proxy. For example, if I have a site at site.example.com, then I could run mod_proxy on proxy.example.com. Whenever you accessed proxy.example.com in your browser, it would download the contents of site.example.com. This way, if you didn?t have access to site.example.com, but had access to proxy.example.com, you could still access site.example.com.

The same can be applied to Webmin. If your web server has Webmin running on localhost but you want it to be accessed via webmin.example.com, you can simply utilise Apache?s Virtual Hosts and mod_proxy to proxy from webmin.example.com to localhost.

Implementing this is easy as. First of all, I?ve only ever done this on an Ubuntu server, so this may or may not apply to your environment.

You will need the mod_proxy Apache module enabled for this. Ubuntu has mod_proxy installed by default, though disabled. Type:


sudo a2enmod proxy


Create a configuration file at /etc/apache2/sites-available/webmin and paste the following code in:


    <IfModule mod_proxy.c>
    <VirtualHost *:80>

# Don't forget to customise the following line to your actual subdomain:
            ServerName webmin.example.com
# The following URLs are for your Webmin server. If Webmin is on a different machine, change these:
            ProxyPass / localhost
            ProxyPassReverse / localhost

            <Proxy *>
                    Order Allow,Deny
                    Allow from all
            </Proxy>

    </VirtualHost>
    </IfModule>


Then, enable the Virtual Host configuration you have just created:

sudo a2ensite webmin

Now restart Apache:

sudo invoke-rc.d apache2 restart


If all went well, you can navigate to webmin.example.com (actually, navigate to where your subdomain is) and see Webmin there.