<?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>Chakkrit Tantithamthavorn&#039;s Official Personal Website &#187; LAMP</title>
	<atom:link href="http://www.klainfo.com/tag/lamp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klainfo.com</link>
	<description></description>
	<lastBuildDate>Wed, 01 Feb 2012 13:12:31 +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>[Ubuntu] Enabled Mod_Rewrite and htaccess on LAMP</title>
		<link>http://www.klainfo.com/2009/07/17/ubuntu-enabled-mod_rewrite-and-htaccess-on-lamp/</link>
		<comments>http://www.klainfo.com/2009/07/17/ubuntu-enabled-mod_rewrite-and-htaccess-on-lamp/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 01:51:24 +0000</pubDate>
		<dc:creator>klainfo</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[AllowOverride]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://blog.klainfo.com/?p=283</guid>
		<description><![CDATA[วิธีการดังกล่าว เหมาะสำหรับ ผู้ที่ต้องการ Deploy Web Framework จำพวก codeigniter, cakephp, zend framework เป็นต้น ซึ่งต้องใช้ Mod_Rewrite และ htaccess Web Server Installation วิธีที่ 1 1. เปิดเทอร์มินัล แล้วพิมพ์ตามนี้เรย $ sudo apt-get install apache2 mysql-server-5.0 libapache2-mod-php5 2. restart apache ครั้งนึง $ sudo /etc/init.d/apache2 restart หรือ วิธีที่ 2 1. เปิดเทอร์มินัล แล้วพิมพ์ตามนี้เรย $ sudo tasksel 2. เลือก Web Server กับ OpenSSH Server [...]]]></description>
			<content:encoded><![CDATA[<p>วิธีการดังกล่าว เหมาะสำหรับ ผู้ที่ต้องการ Deploy Web Framework จำพวก <a href="http://www.codeigniter.com">codeigniter</a>, <a href="http://www.cakephp.org">cakephp</a>, <a href="http://framework.zend.com">zend framework</a> เป็นต้น ซึ่งต้องใช้ Mod_Rewrite และ htaccess</p>
<h1><strong>Web Server Installation</strong></h1>
<p><strong>วิธีที่ 1</strong></p>
<p>1. เปิดเทอร์มินัล แล้วพิมพ์ตามนี้เรย</p>
<div class="wp_syntax">
<div class="code">
<pre class="shell" style="font-family:monospace;">$ sudo apt-get install apache2 mysql-server-5.0 libapache2-mod-php5</pre>
</div>
</div>
<p>2. restart apache ครั้งนึง</p>
<div class="wp_syntax">
<div class="code">
<pre class="shell" style="font-family:monospace;">$ sudo /etc/init.d/apache2 restart</pre>
</div>
</div>
<p>หรือ<strong> วิธีที่ 2</strong></p>
<p>1. เปิดเทอร์มินัล แล้วพิมพ์ตามนี้เรย</p>
<div class="wp_syntax">
<div class="code">
<pre class="shell" style="font-family:monospace;">$ sudo tasksel</pre>
</div>
</div>
<p>2. เลือก Web Server กับ OpenSSH Server</p>
<p>3. restart apache ครั้งนึง</p>
<div class="wp_syntax">
<div class="code">
<pre class="shell" style="font-family:monospace;">$ sudo /etc/init.d/apache2 restart</pre>
</div>
</div>
<p>3. เพิ่มเติม Apache Directory จะอยู่ที่ /etc/apache2</p>
<h1><strong>เปิดบริการ mod_rewrite และ .htaccess</strong></h1>
<p>โดยปกติแล้ว Apache ไม่ได้ Allow ไฟล์ .htaccess กับ Enable Modul Rewrite เพราะฉะนั้น เราต้องไปลงเอง</p>
<p>1. Enabled mod_rewrite ก่อน</p>
<div class="wp_syntax">
<div class="code">
<pre class="shell" style="font-family:monospace;">$ sudo a2enmod rewrite</pre>
</div>
</div>
<p>2. เปิดไฟล์ 000-default เพื่อ <a href="http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride">AllowOverride</a> หมายถึง อนุญาติให้ใช้ไฟล์ .htaccess</p>
<div class="wp_syntax">
<div class="code">
<pre class="shell" style="font-family:monospace;">$ sudo vi /etc/apache2/sites-enabled/000-default</pre>
</div>
</div>
<p>เปลี่ยนจาก &#8220;AllowOverride None&#8221; เป็น &#8220;AllowOverride All&#8221; เพื่อให้ .htaccess ทำงาน จะได้ Code หน้าตาประมาณนี้</p>
<div class="wp_syntax">
<div class="code">
<pre class="text" style="font-family:monospace;">&lt;VirtualHost *:80&gt;
        ServerAdmin webmaster@localhost
	ServerName localhost
	DocumentRoot /var/www
	&lt;Directory /var/www/&gt;
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	&lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre>
</div>
</div>
<p>3. Restart Apache จิ๊ดนุง</p>
<div class="wp_syntax">
<div class="code">
<pre class="shell" style="font-family:monospace;">$ sudo /etc/init.d/apache2 restart</pre>
</div>
</div>
<p>4. ทดสอบด้วยการลอง phpinfo(); ที่ index.php</p>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">phpinfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.klainfo.com/2009/07/17/ubuntu-enabled-mod_rewrite-and-htaccess-on-lamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.klainfo.com @ 2012-02-08 06:02:50 -->
