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.

    17 thoughts on “Creating a Virtual Host with Webmin”

    1. 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?

    2. I fixed it..

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

    3. 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.

    4. 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

    5. @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!!

    6. 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

    7. 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).

    8. 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.

    9. Hi,

      Can you specify how to assign ssl to different subdomains ? For example :

      a.domain.com
      b.domain.com
      c.domain.com

      I need to set ssl for these three different subdomains. Is it necessary to have 3 different IP for these 3 domains ? I am not using wildcard ssl.

      Thanks,
      G

    10. Hi,

      I did everything as written, but my new domain redirects me to my another site, which is not related to the one I am trying to set up. It’s driving me crazy :/

    Leave a Reply

    Your email address will not be published. Required fields are marked *