<?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>klainfo &#187; subdomain</title>
	<atom:link href="http://www.klainfo.com/tag/subdomain/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klainfo.com</link>
	<description>Web2.0, HPC, Unix, and my mine.</description>
	<lastBuildDate>Thu, 09 Sep 2010 16:21:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>[Apache] Create subdomain on localhost</title>
		<link>http://www.klainfo.com/2010/01/31/apache-create-subdomain-on-localhost/</link>
		<comments>http://www.klainfo.com/2010/01/31/apache-create-subdomain-on-localhost/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 18:15:53 +0000</pubDate>
		<dc:creator>klainfo</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[subdomain]]></category>

		<guid isPermaLink="false">http://blog.klainfo.com/?p=602</guid>
		<description><![CDATA[ปกติแล้ว คนที่ทำเวบ ก็สร้าง subdomain ผ่าน direct admin ง่ายมาก แต่ถ้าอยากลองบน localhost จะทำยังไงดีหละ นั่งหาๆเหมือนกัน เลยจดไว้ดีกว่า กันลืม ลองดูวิธีนี้ละกันนะ ง่ายดี สำหรับตัวอย่างนี้ สมมติว่าสร้าง subdomain ชื่อว่า sub โดยมีไดเรคทอรี่อยู่ที่ /var/www/sub เริ่มจาก $ sudo vi /etc/apache2/sites-enabled/000-default เติมข้อความนี้ลงไป ServerAdmin admin@localhost DocumentRoot /var/www/sub ServerName sub.localhost ตามด้วยคำสั่ง $ sudo vi /etc/hosts เติมข้อความนี้ลงไป 127.0.0.1 localhost 127.0.0.1 sub.localhost ลองทดสอบดู ถ้าไม่ได้ให้ restart apache service ก่อนครับ $ sudo /etc/init.d/apache2 restart]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.klainfo.com%2F2010%2F01%2F31%2Fapache-create-subdomain-on-localhost%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.klainfo.com%2F2010%2F01%2F31%2Fapache-create-subdomain-on-localhost%2F&amp;source=klainfo&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>ปกติแล้ว คนที่ทำเวบ ก็สร้าง subdomain ผ่าน direct admin ง่ายมาก แต่ถ้าอยากลองบน localhost จะทำยังไงดีหละ นั่งหาๆเหมือนกัน เลยจดไว้ดีกว่า กันลืม ลองดูวิธีนี้ละกันนะ ง่ายดี<br />
สำหรับตัวอย่างนี้ สมมติว่าสร้าง subdomain ชื่อว่า sub โดยมีไดเรคทอรี่อยู่ที่ /var/www/sub<br />
เริ่มจาก</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-enabled<span style="color: #000000; font-weight: bold;">/</span>000-default</pre></div></div>

<p>เติมข้อความนี้ลงไป</p>
<pre>
ServerAdmin admin@localhost
DocumentRoot /var/www/sub
ServerName sub.localhost
</pre>
<p>ตามด้วยคำสั่ง</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>hosts</pre></div></div>

<p>เติมข้อความนี้ลงไป</p>
<pre>
127.0.0.1    localhost
127.0.0.1    sub.localhost
</pre>
<p>ลองทดสอบดู ถ้าไม่ได้ให้ restart apache service ก่อนครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>เสร็จแล้วๆๆๆ อิอิ</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.klainfo.com/2010/01/31/apache-create-subdomain-on-localhost/" target="_blank"><img src="http://www.klainfo.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.klainfo.com/2010/01/31/apache-create-subdomain-on-localhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
