Setup apache httpd single ip with multiple websites

[root@localhost home]# yum install httpd

Press y to install apache if you havent done so already,

then edit the /etc/httpd/conf/httpd.conf    file and do so:

#Do not Touch Anything else for name based hosting in a single IP. Everything is Default on httpd.conf file.

# Just put NameVirtualHost ip address on the top. It’s very simple.

 

NameVirtualHost 127.0.0.1 (provide the IP you want to serve)

<VirtualHost http://www.siteone.com&gt;

DocumentRoot /var/www/siteone

ServerName http://www.siteone.com

ServerAlias http://www.siteone.com

ErrorLog logs/siteone.com

#RewriteRule ^/.* /www/siteone/index.html

CustomLog logs/siteone.com common

</VirtualHost>

 

<VirtualHost http://www.sitetwo.com&gt;

DocumentRoot /var/www/sitetwo

ServerName http://www.sitetwo.com

ServerAlias http://www.sitetwo.com

ErrorLog logs/sitetwo.com

CustomLog logs/sitetwo.com common

</VirtualHost>

 

<VirtualHost http://www.sitethree.com&gt;

DocumentRoot /var/www/sitethree

ServerName http://www.sitethree.com

ServerAlias http://www.sitethree.com

#RewriteRule ^/.* /www/sitethree/index.html

#ServerPath /sitethree/

ErrorLog logs/sitethree.com

CustomLog logs/sitethree.com common

</VirtualHost>