<?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>system reboot! &#187; apache virtual host</title>
	<atom:link href="http://ibnuyahya.com/tag/apache-virtual-host/feed/" rel="self" type="application/rss+xml" />
	<link>http://ibnuyahya.com</link>
	<description>echo help::answer($question)</description>
	<lastBuildDate>Wed, 25 Apr 2012 09:31:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>mac osx localhost apache virtual host</title>
		<link>http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/</link>
		<comments>http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 16:25:07 +0000</pubDate>
		<dc:creator>ibnuyahya</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[apache virtual host]]></category>
		<category><![CDATA[mac osx]]></category>

		<guid isPermaLink="false">http://ibnuyahya.com/?p=415</guid>
		<description><![CDATA[Objektif 1. Memasang apache, php dan mysql secara manual di dalam Mac Osx 10.6 Snow Leopard. 2. Menggunakan url seperti http://subdomain.test.dev dalam localhost. Memasang Apache dan PHP Sebenarnya Mac osx 10.6 Show Leopard telah di datangkan dengan Apache 2.2.14 dan PHP 5.3.1. Jadi anda hanya perlu mulakan apache dengan arahan berikut. sudo apachectl start Kemudian [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:100px;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fibnuyahya.com%2Fmac-osx-localhost-apache-virtual-host%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe></div>
					<div style="float:left; width:50px; padding-left:10px;" class="really_simple_share_facebook_like_send">
					<fb:send href="http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/" font=""></fb:send></div><div class="really_simple_share_google1" style="width:80px;"><div class="g-plusone" data-size="medium" data-href="http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/" ></div></div><div class="really_simple_share_twitter" style="width:100px;"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="mac osx localhost apache virtual host" data-url="http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/" 
						data-via=""  ></a></div><div class="really_simple_share_linkedin" style="width:100px;"><script type="IN/Share" data-counter="right" data-url="http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/"></script></div><div class="really_simple_share_digg" style="width:100px;"><script type="text/javascript" src="http://widgets.digg.com/buttons.js"></script>
					<a class="DiggThisButton DiggCompact" href="http://digg.com/submit?url=http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/&amp;title=mac osx localhost apache virtual host"></a></div></div>
		<div style="clear:both;"></div><h2>Objektif</h2>
<p>1. Memasang apache, php dan mysql secara manual di dalam Mac Osx 10.6 Snow Leopard.<br />
2. Menggunakan url seperti <a href="http://subdomain.test.dev" rel="nofollow">http://subdomain.test.dev</a>   dalam localhost.</p>
<h2>Memasang Apache dan PHP</h2>
<p>Sebenarnya Mac osx 10.6 Show Leopard telah di datangkan dengan Apache 2.2.14 dan PHP 5.3.1. Jadi anda hanya perlu mulakan apache dengan arahan berikut.</p>
<pre class="brush:bash">sudo apachectl start</pre>
<p>Kemudian uji localhost anda dengan menaip <a href="http://localhost/" rel="nofollow">http://localhost/</a> di browser. Jika berjaya, anda akan dapat lihat mesej</p>
<blockquote><p>It works!</p></blockquote>
<p>Walaupun telah didatangkan dengan php, namun ia tidak di load di dalam apache secara default. Jadi anda perlu edit fail httpd.conf seperti di bawah<br />
1. buka terminal<br />
2. gunakan editor kegemaran anda untuk edit fail httpd.conf di lokasi /etc/apache2/httpd.conf .Dalam contoh ini, saya gunakan nano</p>
<pre class="brush:bash">sudo nano /private/etc/apache2/httpd.conf</pre>
<p>3. cari line ini</p>
<pre class="brush:bash">#LoadModule php5_module        libexec/apache2/libphp5.so</pre>
<p>dan buang komen yang ada menjadi</p>
<pre class="brush:bash">LoadModule php5_module        libexec/apache2/libphp5.so</pre>
<p>4. Restart apache</p>
<pre class="brush:bash">sudo apachectl restart</pre>
<h2>Uji sama ada configuration anda berjaya ataupun tidak.</h2>
<p>1. Bina fail phpinfo.php</p>
<pre class="brush:bash">sudo nano /Library/WebServer/Documents/phpinfo.php</pre>
<p>taip dan save kod berikut</p>
<pre class="brush:php">
&lt;?php
    phpinfo();
?&gt;
</pre>
<p>2. buka url berikut <a href="http://localhost/phpinfo.php" rel="nofollow">http://localhost/phpinfo.php</a></p>
<h2>Memasang MYSQL</h2>
<p>1. Muat turun fail Mysql <a href="http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg">http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg</a> .Pilih sama ada 32 bit ataupun 64 bit bergantung kepada sistem komputer anda.<br />
2. Install kesemua file didalam *.dmg iaitu <strong>mysql</strong>, <strong>mysql startup item</strong> dan <strong>preference pane</strong>.<br />
3. Start Mysql dari preferences.. ( Apple -> system preferences -> mysql )</p>
<h2>Memasang virtual host</h2>
<p>1. edit fail host</p>
<pre class="brush:bash">
sudo nano /private/etc/hosts
</pre>
<p>2. Masukkan </p>
<pre class="brush:bash">
127.0.0.1    subdomain.test.dev
</pre>
<p>3. Edit fail httpd.conf untuk enablekan virtual host</p>
<pre class="brush:bash">sudo nano /private/etc/apache2/httpd.conf</pre>
<p>4. cari line ini </p>
<pre class="brush:bash">
# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf
</pre>
<p>dan buang komen yang ada menjadi</p>
<pre class="brush:bash">
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
</pre>
<p>5. edit fail httpd-vhosts.conf</p>
<pre class="brush:bash">
sudo nano /private/etc/apache2/extra/httpd-vhosts.conf
</pre>
<p>6. buang atau komen</p>
<pre class="brush:bash">
#<VirtualHost *:80>
#    ServerAdmin <a href="mailto:webmaster@dummy-host.example.com">webmaster@dummy-host.example.com</a>
#    DocumentRoot "/usr/docs/dummy-host.example.com"
#    ServerName dummy-host.example.com
#    ServerAlias <a href="http://www.dummy-host.example.com" rel="nofollow">http://www.dummy-host.example.com</a>
#    ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
#    CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" com$
#</VirtualHost>

#<VirtualHost *:80>
#    ServerAdmin <a href="mailto:webmaster@dummy-host2.example.com">webmaster@dummy-host2.example.com</a>
#    DocumentRoot "/usr/docs/dummy-host2.example.com"
#    ServerName dummy-host2.example.com
#    ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
#    CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" co$
#</VirtualHost>
</pre>
<p>7. masukkan </p>
<pre class="brush:bash">
&lt;VirtualHost *:80&gt;
    DocumentRoot &quot;/Library/WebServer/Documents&quot;
    ServerName localhost
&lt;/VirtualHost&gt;

&lt;VirtualHost *:80&gt;
    DocumentRoot &quot;/Projects/myprojects&quot;
    ServerName subdomain.test.dev
    ErrorLog &quot;/Private/var/log/apache2/myprojects.local-error_log&quot;
    &lt;Directory &quot;/Projects/myprojects&quot;&gt;
        Options Indexes FollowSymLinks
        AllowOverride All
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;
</pre>
<p>dalam contoh di atas, anda gantikan ServerName kepada nama virtual host anda dan path &#8220;/Projects/myprojects&#8221; dengan lokasi folder projek php anda.</p>
<p>8. clear cache</p>
<pre class="brush:bash">
sudo dscacheutil -flushcache
</pre>
<p>9. restart apache</p>
<pre class="brush:bash">
sudo apachectl restart
</pre>
<p>10. sekarang anda boleh akses ke url <a href="http://subdomain.test.dev" rel="nofollow">http://subdomain.test.dev</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ibnuyahya.com/mac-osx-localhost-apache-virtual-host/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/

Minified using apc (Feed is rejected)
Page Caching using apc
Database Caching 5/20 queries in 0.003 seconds using apc
Object Caching 384/395 objects using apc

Served from: _ @ 2012-05-20 05:08:55 -->
