Tag Archives: apache

Konfigurasi Apache, PHP dan MySQL di OS X 10.8 Mountain Lion

Saya pernah menulis tentang cara menginstall dan konfigurasi Apache, PHP dan MySQL di OS X 10.6 Snow Leopard. Dan dua hari yang lalu saya mengupdate OS saya menjadi OS X 10.8 Mountain Lion. Konfigurasi dapat dilakukan seperti pada tulisan saya tersebut. namun ada sedikit perbedaan.

OS X 10.8 Mountain Lion tidak menyediakan opsi web sharing di dalam System Preferences -> Sharing. Untuk  memulai dan mematikan Apache digunakan perintah “sudo apachectl restart” di terminal.

Konfigurasi agar masing-masing user dapat mempunyai alamat sendiri, misalnya http://localhost/~username/, adalah dengan cara membuat file di dalam folder “/etc/apache2/users/“. File tersebut diberi nama {USERNAME}.conf. Silahkan ganti {USERNAME} dengan username anda. Misalkan username anda adalah stevejobs, maka beri nama file dengan stevejobs.conf. Isi file tersebut adalah:

<Directory “/Users/{USERNAME}/Sites/”>
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all

Ganti {USERNAME} dengan username anda yang sesuai.

Untuk menginstall atau mengaktifkan PHP dan MySQL di OS X 10.8 Mountain Lion sama seperti di OS X 10.6 Snow Leopard. Dapat dilihat di sini.

Dan sekarang installasi telah selesai. Restart apache anda. 🙂

Enable Mod Rewrite on Snow Leopard

After enable Apache and PHP (also installing MySQL) on my macbook, i want to enable mod rewrite (Rewrite engine) .  From wikipedia, Mod rewrite (rewrite engine) described as  software that modifies a web URL‘s appearance (URL rewriting). Rewritten URLs (sometimes known as short, fancy URLs, or search engine friendly – SEF) are used to provide shorter and more relevant-looking links to web pages. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world.

By default, mod rewrite has been enabled. But we need edit some configuration before we can use it.

  1. Go to /etc/apache2/httpd.conf than edit the <Directory /> section. Change AllowOverride to All
        AllowOverride All
  2. Edit /etc/apache2/users/youruser.conf, change to this:
    <Directory "/Users/youruser/Sites/">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride All
     Order allow,deny
     Allow from all
    <Directory "/Users/youruser/Sites/*/">
     Options Indexes MultiViews FollowSymLinks
  3. Done. 🙂

Apache PHP MySQL on Mac OS X 10.6

By default, Mac OS X come with preinstalled Apache and PHP. But for a while, i’m using XAMPP for Mac in my macbook because in my first time using Mac OS, i don’t know about it.

Yesterday, i tried to using preinstalled Apache and PHP, also adding MySQL. For enable Apache, it just take a click. Go to System Preferences -> Sharing
Continue reading