<?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>Jeff&#039;s Notes &#187; Apache</title>
	<atom:link href="http://www.jeffreyjason.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffreyjason.com</link>
	<description>Drop me a line with suggested topics: umassthrower@gmail.com.</description>
	<lastBuildDate>Sat, 17 Dec 2011 21:37:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Name Based Virtual Hosting with Apache 2.2 (A Quickie)</title>
		<link>http://www.jeffreyjason.com/2010/07/18/name-based-virtual-hosting-with-apache-2-2-a-quickie/</link>
		<comments>http://www.jeffreyjason.com/2010/07/18/name-based-virtual-hosting-with-apache-2-2-a-quickie/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 19:24:26 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
				<category><![CDATA[Systems]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[Apache subdomains]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[multiple domains one server]]></category>
		<category><![CDATA[name based virtual host]]></category>
		<category><![CDATA[VirtualHost]]></category>

		<guid isPermaLink="false">http://www.jeffreyjason.com/?p=116</guid>
		<description><![CDATA[Abstract This quickie tells how to run multiple websites on one server with 1 ip address using Apache Http Server version 2.x. Prerequisites Apache Http Server 2.0+  sudo apt-get install apache2 apache2-mpm-worker apache2-utils apache2.2-common (note: php.net &#8230; <a class="more-link" href="http://www.jeffreyjason.com/2010/07/18/name-based-virtual-hosting-with-apache-2-2-a-quickie/">More<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div style='float:right'>
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=FFFFFF&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jefsnot-20&#038;o=1&#038;p=8&#038;l=as1&#038;m=amazon&#038;f=ifr&#038;md=10FE9736YVPPT7A0FBG2&#038;asins=0596529945" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<h3>Abstract</h3>
<p>This quickie tells how to run multiple websites on one server with 1 ip address using Apache Http Server version 2.x.</p>
<h3>Prerequisites</h3>
<ol>
<li><a href="http://httpd.apache.org/" target="_blank">Apache Http Server</a> 2.0+  <tt>sudo apt-get install apache2 apache2-mpm-worker apache2-utils apache2.2-common</tt> (note: <a href="http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2" target="_blank">php.net recommends</a> mpm-prefork for mod_php enabled servers)</li>
<li><a href="http://www.consumersearch.com/domain-registration" target="_blank">A domain</a> (or more specifically 2, but we&#8217;ll quickly hit setting up subdomains)</li>
<li>And two server roots with index files</li>
</ol>
<h3>DNS Setup</h3>
<p>First you have to register your domain with your hosting provider&#8217;s name servers.  I use <a href="http://www.linode.com/?r=7fd75750b7c3a12e8c7c6cde69316600392e2235" target="_blank">Linode</a> and they have a pretty straightforward web utility for setting up your zone files.  For the purposes of this quickie you&#8217;re looking to add hostname entries to make your zone files look something like this:</p>
<pre>; jeffreyjason.com [102453]
$TTL 86400
@	IN	SOA	ns1.linode.com. umassthrower.gmail.com. (
					2010071855
					14400
					14400
					1209600
					86400
				)
@		NS	ns1.linode.com.
@		NS	ns2.linode.com.
@		NS	ns3.linode.com.
@		NS	ns4.linode.com.
@		NS	ns5.linode.com.
@			MX	10	mail.jeffreyjason.com.
@			A	97.107.129.122
www			A	97.107.129.122
mail			A	97.107.129.122
redmine			A	97.107.129.122
xcache			A	97.107.129.122</pre>
<h3>httpd.conf setup</h3>
<p><tt><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;">Inside your apache configuration file you need to add the following line to turn enable name based virtual hosting</span></tt></p>
<p><code>NameVirtualHost *:80</code></p>
<p>Next you setup the virtual host configuration for your sites.  Here is a minimalist example of 2 of mine with the cruff stripped out:</p>
<p>www.jeffreyjason.com</p>
<pre>&lt;VirtualHost *:80&gt;
        ServerName jeffreyjason.com
        DocumentRoot /var/www/jeffreyjason.com/
&lt;/VirtualHost&gt;</pre>
<p>redmine.jeffreyjason.com</p>
<pre>&lt;VirtualHost *:80&gt;
        ServerName redmine.jeffreyjason.com
        DocumentRoot /var/www/redmine/
&lt;/VirtualHost&gt;</pre>
<p>Finally you restart apache and, assuming your subdomain entries have propagated, you should now be serving 2 sites from one server.  The process is the same with 2 separate domains, you will just have 2 separate zone files pointing to the same IP.  Before we go don&#8217;t forget to add ServerAlias directives to your virtual host configurations in order to have your visitors not end up with an error message when they inevitable try to access www.subdomain.domain.tld.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.jeffreyjason.com%2F2010%2F07%2F18%2Fname-based-virtual-hosting-with-apache-2-2-a-quickie%2F&amp;title=Name%20Based%20Virtual%20Hosting%20with%20Apache%202.2%20%3Cbr%20%2F%3E%28A%20Quickie%29" id="wpa2a_2"><img src="http://www.jeffreyjason.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffreyjason.com/2010/07/18/name-based-virtual-hosting-with-apache-2-2-a-quickie/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

