<?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>var/log &#187; centos</title>
	<atom:link href="http://www.varslashlog.com/tag/centos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.varslashlog.com</link>
	<description>Yet another weblog</description>
	<lastBuildDate>Sat, 12 Sep 2009 13:34:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to setup subdomains in apache</title>
		<link>http://www.varslashlog.com/2008/10/31/how-to-setup-subdomains-in-apache/</link>
		<comments>http://www.varslashlog.com/2008/10/31/how-to-setup-subdomains-in-apache/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 14:31:07 +0000</pubDate>
		<dc:creator>Aleks</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[subdomain]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.varslashlog.com/?p=61</guid>
		<description><![CDATA[It&#8217;s not difficult to run a website without using expensive applications like plesk. It&#8217;s really not that difficult to setup a subdomain or site yourself. Here I will show an easy method of setting up subdomains. Though this might not be a perfect way of doing it. At least it easy, and you have the [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not difficult to run a website without using expensive applications like plesk. It&#8217;s really not that difficult to setup a subdomain or site yourself. Here I will show an easy method of setting up subdomains. Though this might not be a perfect way of doing it. At least it easy, and you have the site up and running in 5 minutes.<span id="more-61"></span>If we do this guide by setup the site for example.tld and one subdomain, admin. The DNS records did I show how to setup in <a title="How to setup DNS in BIND" href="http://www.varslashlog.com/2008/10/30/how-to-setup-dns-in-bind/">this guide about how to setup DNS in BIND.</a></p>
<p>We start by setting up the paths to our new domin. It might be a good idea to put new domains in the home directory. Though you are free to put them where you want.</p>
<p>I personally use the home directory, and will base my short guide on doing so.</p>
<p>Start by creating the domain as a folder in the home directory.</p>
<blockquote><p># mkdir /home/example.tld</p></blockquote>
<p>Next give apache owner rights over the folder</p>
<blockquote><p># chown apache:apache /home/example.tld</p></blockquote>
<p>Change the directory to the example.tld.</p>
<blockquote><p># cd /home/example.tld</p></blockquote>
<p>We want to make two directories, one to store our web page to example.tld, and one to store subdomains.</p>
<blockquote><p># mkdir htdocs<br />
# mkdir subdomains<br />
# chown apache:apache htdocs<br />
# chown apache:apache subdomains</p></blockquote>
<p>Since we are going to add one subdomain, we will add our subdomain &#8220;admin&#8221; to our subdomain folder.</p>
<blockquote><p># mkdir subdomains/admin<br />
# chown apache:apache subdomains/admin</p></blockquote>
<p>And at last create a htdocs folder in the admin subdomain folder.</p>
<blockquote><p># mkdir subdomins/admin/htdocs<br />
# chown  apache:apache subdomains/admin/htdocs</p></blockquote>
<p>We are almoust ready now. Put your web page files into the htdocs folders, or just create a dummy index.html with &#8220;Hello World&#8221; or something. If you get many folders and files and need th change the owner on all you can run this command to change all files and dirs to the apache user and group.</p>
<blockquote><p># chown apache:apache -R /home/example.tld</p></blockquote>
<p>Now we are ready to edit the apache configuration.</p>
<p>Open the configuration file (you need to be root or have sudo privileges)</p>
<blockquote><p>#vi /etc/httpd/conf/httpd.conf</p></blockquote>
<p>Go to the end of the configuration file and go into insert mode. Add two virtual hosts in this file at the far end.</p>
<p>First Add the virtual host if it&#8217;s not present</p>
<blockquote><p>NameVirtualHost *:80</p></blockquote>
<p>Then add the virtual host for the main domain, example.tld</p>
<blockquote><p>&lt;VirtualHost *:80&gt;<br />
DocumentRoot /home/example.tld/htdocs<br />
ServerName example.tld<br />
&lt;Directory &#8220;/home/example.tld/htdocs&#8221;&gt;<br />
allow from all<br />
Options +Indexes<br />
&lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</p></blockquote>
<p>Next add the virtual host for the subdomain. Repeat this one for every subdomain you want</p>
<blockquote><p>&lt;VirtualHost *:80&gt;<br />
DocumentRoot /home/example.tld/subdomains/admin/htdocs<br />
ServerName admin.example.tld<br />
&lt;Directory &#8220;/home/example.tld/subdomains/admin/htdocs&#8221;&gt;<br />
allow from all<br />
Options +Indexes<br />
&lt;/Directory&gt;</p></blockquote>
<p>Save the configuration and restart apache</p>
<blockquote><p># service httpd restart</p></blockquote>
<p>Finished!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.varslashlog.com/2008/10/31/how-to-setup-subdomains-in-apache/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
