Introduction to Apache Virtual Hosts
One great benefit of VPS hosting is being able to easily host multiple websites off the same server. Owning a VPS offers much more than just web hosting but in this tutorial we will show you how to setup virtual hosts with Apache.
Apache HTTP Server is probably one of the most influential pieces of open-source software that let to the explosive growth of the World Wide Web today. Still going strong it is the leading web server used across the internet today. Apache HTTP Server runs on many operating systems such as Unix, Linux, BSD, Windows, OSX, and Solaris, among others.
Apache HTTP Server is developed by the Apache Software Foundation, and has a strong community of developers supporting the project.
Apache V-Hosts Configuration
Setting up v-hosts is straightforward. In your HTTP Configuration file add the following lines. Modify the settings for your environment. If you have any question leave a comment and we will get back to you.
Shared IP with Multiple Virtual Hosts
# accept virtual host requests on all IP's NameVirtualHost *:80
DocumentRoot /www/domain1 ServerName www.domain1.com DocumentRoot /www/domain2 ServerName www.domain2.net
Virtual Hosts with dedicated IP addresses
Listen 80 # This is the server running on your main IP. ServerName server.maindomain.com DocumentRoot /www/maindomain # Virtual Servers will use other IP address NameVirtualHost 220.127.116.11
DocumentRoot /www/domain1 ServerName www.domain.com DocumentRoot /www/domain2 ServerName www.domain2.net
Combination Name Based and IP Based Apache Virtual Hosts
Listen 80 NameVirtualHost 18.104.22.168
DocumentRoot /www/domain1 ServerName www.domain.com DocumentRoot /www/domain2 ServerName www.domain2.org DocumentRoot /www/domain3 ServerName www.domain3.com## - IP Based Hosted Domains DocumentRoot /www/domain4 ServerName www.domain4.info DocumentRoot /www/domain5 ServerName www.domain5.me
Tags: vps, web hosting, Linux, apache, how-to, virtual hosts
This work is licensed under a
Creative Commons Attribution-