<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A K Chauhan's Blog &#187; Vistual Host</title>
	<atom:link href="http://www.akchauhan.com/tag/vistual-host/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.akchauhan.com</link>
	<description>PHP, MySql, JavaScript, JQuery, Prototype, Drupal, HTML, CSS and more...</description>
	<lastBuildDate>Mon, 02 Jan 2012 03:29:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Create Virtual Hosts and run multiple websites on Amazon server</title>
		<link>http://www.akchauhan.com/create-virtual-hosts-and-run-multiple-websites-on-amazon-server/</link>
		<comments>http://www.akchauhan.com/create-virtual-hosts-and-run-multiple-websites-on-amazon-server/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 07:42:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Vistual Host]]></category>

		<guid isPermaLink="false">http://www.akchauhan.com/?p=525</guid>
		<description><![CDATA[You can create virtual hosts on any Linux or window platform if you are using Apache web server. Virtual hosts or v-hosts is basically Apache feature. I&#8217;m considering here Amazon server running with Apache version 2 or above. So, basically for creating v-hosts you need to modify Apache&#8217;s configuration (httpd.conf) file. You need the root [...]]]></description>
			<content:encoded><![CDATA[<p>You can create <strong>virtual hosts</strong> on any Linux or window platform if you are using <strong>Apache web server</strong>. Virtual hosts or v-hosts is basically Apache feature. I&#8217;m considering here Amazon server running with Apache version 2 or above. So, basically for creating v-hosts you need to modify Apache&#8217;s configuration (<strong>httpd.conf</strong>) file. You need the root access for all this modifications. Here I&#8217;m showing how we create the &#8220;<strong>name-based virtual hosting</strong>&#8220;. This is the easiest way of creating virtual host.<br />
On Amazon server httpd.conf is located on &#8216;<strong>/etc/httpd/conf/httpd.conf</strong>&#8216; location. You need to follow these steps:-<br/><br />
<strong>1. First, take the backup of this file so in case if anything goes wrong you can rollback changes.</strong><br />
<strong>2. Download this file in your local machine and open it in any text editor.</strong><br />
<strong>3. Go to section 3 (Virtual Hosts)  of this document.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">### Section 3: Virtual Hosts</pre></div></div>

<p><strong>4. Un-comment this line</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">NameVirtualHost *:80</pre></div></div>

<p><strong>5. Now create v-hosts like this</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;VirtualHost *:<span style="color: #cc66cc;">80</span>&gt;</span>
    ServerAdmin admin@mydomain1.com
    DocumentRoot /var/www/html/domainname1
    ServerName www.domainname1.com
    ErrorLog logs/www.domainname1.com-error_log
    CustomLog logs/www.domainname1.com-access_log common
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>VirtualHost&gt;</span>
<span style="color: #009900;">&lt;VirtualHost *:<span style="color: #cc66cc;">80</span>&gt;</span>
    ServerAdmin admin@mydomain2.com
    DocumentRoot /var/www/html/domainname2
    ServerName www.domainname2.com
    ErrorLog logs/www.domainname2.com-error_log
    CustomLog logs/www.domainname2.com-access_log common
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>VirtualHost&gt;</span></pre></div></div>

<p>Here we have create two virtual host one <strong>www.domainname1.com</strong> and second one <strong>www.domainname2.com</strong>. <strong>We have specified 5 Apache directive into a VirtualHost container.</strong> We can put almost any Apache directive into a VirtualHost container. Let&#8217;s discuss each one by one.<br/><br />
<strong>ServerAdmin</strong> &#8211; Here we specified email address of server administrator. If there is any issue Apache show this email address for contact.<br />
<strong>DocumentRoot </strong> &#8211; Here we give the absolute path of directory where our website files are located.<br />
<strong>ServerName </strong> &#8211; Here we give the name of our domain which is pointed to &#8220;/var/www/html/domainname1&#8243; directory.<br />
<strong>ErrorLog</strong> &#8211; Absolute path of Error log file for this domain.<br />
<strong>CustomLog</strong> &#8211; Absolute path of custom log file for this domain.<br/></p>
<p><strong>6. Restart the Apache web server to apply these changes.</strong><br />
You can restart your Apache server using Terminal or Putty on Windows.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">service httpd restart</pre></div></div>

<p><strong>Note:-</strong> One more thing which you need to do is you need to point both the domains &#8220;www.domainname1.com&#8221; and &#8220;www.domainname2.com&#8221; to the IP address of the Amazon server. </p>
<p>The Apache server it self find out the domain name form <strong>request header</strong> and point the incoming request to correct &#8220;<strong>DocumentRoot</strong>&#8221; directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akchauhan.com/create-virtual-hosts-and-run-multiple-websites-on-amazon-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

