Creating a Virtual Host with Webmin

These instructions apply to Webmin version 1.450
  1. Create a folder where you wish to store your sites files. 
    • You can do this in the Others > File Manager section. 
    • We typically use something like: /sites/domainname.com/http/
  2. Setup the vhost.
    • Click on Servers > Apache Web Server in the left hand menu.
    • Click the “create virtual host” tab.
    • You can leave most settings as their default values, but you should fill out the following:
      • Port: Generally, you’ll want to use port 80.
      • Document Root: This is folder where you site’s files will be stored. Pick the folder you created in step 1.
      • Server name: This is just your site’s domain name, e.g. domainname.com (leave out the www.)
    • Click “Create Now”
  3. Add a server alias for www.domainname.com 
    • Click on the “Existing Virtual Hosts” tab in Servers > Apache Web Server.
    • Click the virtual server you just created.
    • Click on “Networking and Addresses”
    • In the “Alternate Virtual Server Names” box, add any additional server aliases you want to use for this site, such as www.domainname.com
    • Press “Save”.
  4. Click “Apply Changes” to get Webmin to restart Apache.

    , , ,

    14 Responses to Creating a Virtual Host with Webmin

    1. Louis March 17, 2009 at 5:08 am #

      Thanks so much for this reference. I kept missing the server aliases.

    2. Adam March 20, 2009 at 5:44 pm #

      I can’t get this to work, I have a domain pointing to a fresh apache2 server but when I add the virtual host the site displays the /var/www contents instead of the path I configured for my host. Out of the box there is a Default Server and a Virtual Server am I supposed to delete these first?

    3. Adam March 20, 2009 at 6:30 pm #

      I fixed it..

      by adding NameVirtualHost * at the top of the default-000 config file in /etc/apache2/sites-enabled above the section.

    4. nigel dewar October 3, 2009 at 5:42 pm #

      This worked great, thanks very much!

    5. Jack October 5, 2009 at 10:16 am #

      How do you add multiple virtual hosts without it pointing to just one? I have three domains and set-up three virtual hosts but all three are pointing to just the same virtual host.

    6. Lee October 20, 2009 at 12:18 am #

      Thank you Paul.

      After searching for days, this has been the ONLY how to that wasn’t written in geek speak which made it easily understood by me.

      Have you others?

      Thanks again

    7. Paul Maunders November 4, 2009 at 4:14 pm #

      Glad you found it useful Lee! Unfortunately, this is the only webmin guide I’ve written, as I don’t use it that much.

    8. mgilbe1 June 5, 2010 at 9:05 am #

      @Adam, you’re a legend. Been bashing my head against this for hours now, and adding that line sorted me out.

      And thanks Paul for a very clear guide!!

    9. Jos June 9, 2010 at 1:52 pm #

      worked for me too Adam, kudos!

    10. villatux July 13, 2010 at 3:31 pm #

      I tried to add multiple virtual host, but i get 403 errror “Forbidden” , what can i do?

      i tried to change the folder and files permissions with chmod but not works yet. =(

      i see the domain in the url but not my index file

    11. matt November 12, 2010 at 4:43 am #

      In my case, do this from console:

      vi /etc/httpd/conf/httpd.conf

      Look for this section:
      # Use name-based virtual hosting.
      #
      #NameVirtualHost *:80

      Remove the # in at NameVirtualHosts (place cursor over # hit i, then delete, escape key, the :wq and enter).

    12. Karel October 16, 2011 at 6:25 pm #

      Spent 8 hours fiddeling around to get multiple domains/hosts working.

      Adams tip worked! :)
      For me I had to edit httpd.conf and remove a # in front of the line.

      See matt’s mini tutorial.

    13. André May 25, 2012 at 2:46 pm #

      Thanks for this. I have been wanting to know how to do this for a while now…Worked perfectly!

    14. Sepu January 18, 2013 at 11:13 am #

      Thank you very much!

    Leave a Reply