Friday, November 14, 2008

Adding a Virtual Host to Apache2 based on Port

Today I had to setup an internal testbed server for one of our websites.  I didn't want to create a new host name for the site on our Apache server so I went with port based virtual hosts.

There are a few things you need to add for this to work.  My first attempt to make this happed in Webmin didn't produce the results I wanted, so I turned to my trusty text editor vi.

vi /etc/httpd/conf/httpd.conf

Now I had to add in a line similar to:
Listen 8080

Also you have to tell apache to use name based virtual hosting. So add in the line:
NameVirtualHost *:8080

Then finally you can create the directives for your virtual host.
DocumentRoot /your/path/here


Matt said...

I used to use webmin years ago. I liked it, except I ran it on Slackware, which meant to keep software up to date, I had to compile it myself, which usually broke webmin's idea of where things should have gone on Slackware. I eventually just sort of gave up on it.

How is the feature set on it now-a-days?

Steve.Lippert said...

The feature set is pretty good. I am lucky enough to be running CentOS, Fedora, or RedHat so I can use the RPMs from Webmin's site. I have only installed and updated my servers once since I rolled it out here a few months ago and the update went smoothly.

I highly suggest you take another look at it. It's not 100% as there are somethings I wish it could do but doesn't.