Categories
Other

Webmin Virtual Host Not Working? Here’s How To Fix It.

One of the most frustrating experiences when setting up a new web server is trying to get your virtual hosts to work correctly.  The program Webmin is supposed to make this easier, however you’re are often left by Webmin with a virtual host (or hosts) that is not working.  There are a few tell-tale signs that your virtual host files are broken or not working correctly, and the most obvious is that you go to one site, but get another.  For instance, lets say that you have a virtual host set up for apacheWebSite.com and it points to /home/apacheWebSite.com/htdocs.  Now let’s assume you have another virtual host setup for nginxWebSite.com and it points to /home/nginxWebSite.com/htdocs.  Webmin has configured your virtual host wrong if you go to apacheWebSite.com and get nginxWebSite.com’s content (or vice-versa).  To fix it, do the following:

1:  Open /etc/apache2/apache2.conf in the editor of your choice.

2:  Comment out (using ‘#’) or delete the line that says:

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

3:  Add the following to the bottom of the same file (substituting your site information) and then follow it as a template for adding more virtual hosts in the future.

#Virtualhosts
<VirtualHost *:80>
DocumentRoot /var/www
</VirtualHost>

<VirtualHost *:80>
DocumentRoot “/home/wrestlingaddix.com/htdocs”
ServerName wrestlingaddix.com
ServerAlias www.wrestlingaddix.com
<Directory “/home/wrestlingaddix.com/htdocs”>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot “/home/dansbikeshop.org/htdocs/dansbikesWP”
ServerName dansbikeshop.org
ServerAlias www.dansbikeshop.org
<Directory “/home/dansbikeshop.org/htdocs/dansbikesWP”>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

4:  Reload Apache by executing /etc/init.d/apache2 reload.

That’s it!  It’s really much simpler to create the virtual hosts without Webmin.

By Jack Slingerland

Founder of Kernl.us. Working and living in Raleigh, NC. I manage teams of software engineers and work in Python, Django, TypeScript, Node.js, React+Redux, Angular, and PHP. I enjoy hanging out with my wife and kids, lifting weights, and PC gaming in my free time.

5 replies on “Webmin Virtual Host Not Working? Here’s How To Fix It.”

Thanks for this post I had the problem, that when you add a virtual host in when running more that 2 sites and what it would do is point all virtual hosts the the same web address.

Kind Regards
mypcmates.com

Same problem as above. I appreciate the info, I agree adding the text wasn’t that difficult. The annoying thing is that I installed webmin for the sole purpose of having a GUI so I wouldn’t have to edit text files. Ahhhh! here I am back to the command line. I have to say the last 4 days of dealing with Fedora and Ubuntu have left me very disenfranchised with the Linux brand. I hate the command line and it seems Linux refuses to accept that the part time admin doesn’t want to remember the 500 commands required to get through the linux day. Ironically when I setup my first server 4 years ago the GUI tools were provided by default and worked on the older versions of Fedora. Now there simply aren’t any. Seems they are going in the wrong direction IMHO.

Comments are closed.