These instructions apply to Webmin version 1.450
- 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/
- 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”
- 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”.
- Click “Apply Changes” to get Webmin to restart Apache.
Thanks so much for this reference. I kept missing the server aliases.
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?
I fixed it..
by adding NameVirtualHost * at the top of the default-000 config file in /etc/apache2/sites-enabled above the section.
This worked great, thanks very much!
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.
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
Glad you found it useful Lee! Unfortunately, this is the only webmin guide I’ve written, as I don’t use it that much.
@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!!
worked for me too Adam, kudos!
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
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).
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.
Thanks for this. I have been wanting to know how to do this for a while now…Worked perfectly!
Thank you very much!
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
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 :/
Oh, i have found out where is the problem 🙂