RimuHosting: Mighty Linux Servers.  Support Worth Raving About
Plans & Pricing
Server Recommendation Tool
Server Types
  VPS
  Semi-dedicated Server
  Dedicated Server
Server Locations
  Dallas
  London
  Australia
VPS Technology
Hardware
Data Centers
Linux Distributions
Applications
Maintenance Notices
Support Ticket
Control Panel
HOWTO Articles
Forums
VPS control panel
Billing details
Receipts
Contact details
DNS
Reverse DNS
Console-over-SSH
FTP backup space
Backup mail server
About
Staff
News
Customer Testimonials
Sales Inquiry
Link To Us
Terms and Conditions
Site Map

Order VPS Hosting
Order a VPS, Semi- dedicated or Dedicated server in Dallas, London or Australia.

Get Assistance
Ask our support team about your hosting requirements.


Host where the staff takes pride in making customers happy

Just a quick note to congratulate you and your team on your 5 years of continued success! You've provided tremendous value and an outstanding level of support over the years. Keep up the good work!

- Joachim (#9/269)
Home > Support > HOWTO List > Web > Virtual Hosts

Web howtos

Host Multiple Domains: Setting Up Virtual Hosts With Webmin

If you want to run multiple websites from your VPS, then you can use Apache's support for Virtual Hosts.

First up, where are you going to put your HTML files? You can put the files anywhere you want, but one useful convention is to have a Linux user per virtual host.  And to put the HTML files under that user's home directory.  This is especially convenient if the user will be uploading files via FTP, since if you chroot the user's FTP access then they can only access files in their home directory.

To setup a user, run something like this:


username=TheDomainNameWithoutAnyDots
adduser $username
passwd $username
mkdir -p ~$username/htdocs
chown -R $username ~$username

Then, to create a virtual host using Webmin:

After you have created the Virtual Host, there are a few other things you may wish to edit.

For example, click on the Virtual Host, and go to Networking and Addresses.  Enter an "Alternate virtual server names" of *.YourOtherDomain.com.  With this setting, your virtual host will serve pages for http://yourotherdomain.com/ as well as http://www.yourotherdomain.com/.

At this point you may also wish to set other options like "Log Files", so the log files for the Virtual Host end up in separate log file from the main server's log files.

To activate your changes, click "Apply Changes" on the main Apache Webmin page.

Of course, be sure to configure your DNS server so the virtual host domain name points to your server's IP address.

Webmin creates a VirtualHost directive in the Apache config file (/etc/httpd/conf/httpd.conf).  An example VirtualHost directive looks like this:

<VirtualHost *:80>
DocumentRoot /home/vhostdomain.com/htdocs
ServerName vhostdomain.com
ServerAlias *.vhostdomain.com
</VirtualHost>

See http://httpd.apache.org/docs/2.2/vhosts/examples.html for some more VirtualHost examples.

Resolving: [warn] _default_ VirtualHost overlapon port 80, the first has precedence

If you get this error when restarting Apache, un-comment the NameVirtualHost *:80 line in /etc/httpd/conf/httpd.conf. (By default we uncomment this line on our Red Hat based distributions.)

Resolving: 403 Forbidden

Unix needs to be able to 'execute' directories in order to open them (not 'read' them as you would expect). If you get a forbidden error, make sure that the directory containing your HTML files and each of its parent directories has chmod o+x set on it. The following script should do that for you:


dir=/home/somevhostdomain.com/htdocs/; 
while true; do 
# the exit case when we get to the top level directory /
if [ -z "$dir" -o "$dir" = "/" ]; then 
    break; 
fi; 
echo chmodding o+x $dir; 
# make the directory exectuable (openable) by others
chmod o+x $dir; 
# go 'up' a directory
dir=`dirname $dir`; 
done