Configuring Apache2 VirtualHost for Multiple Host Names

June 9, 2008 § Leave a comment

I kept forgetting on how to do it.

This is a reminder for myself, and hopefully can be useful for readers.

See this Drupal article!


  • Mac OS X hosts file is located at: /etc/hosts
  • Default Apache2 vhosts file on Mac OS X is located at: /private/etc/apache2/extra/httpd-vhosts.conf

Apache & CherryPy Tutorial

May 16, 2007 § Leave a comment

I cannot write it better than his.

So, I’ll just include the original article here.


Other References:

Configuring Apache2 and PHP on Mac OS X for Development

April 23, 2007 § 4 Comments

This article would serve as public cheat sheet on how to configure everything from scratch. Again…

  1. Grab the latest Apache 2.0 / 2.2 as well as PHP5
  2. Unzip them with this command: tar -xzf [your_file].tar
  3. Go to the created httpd directory (for apache) or php directory.
  4. Run: sudo ./configure. This is the crucial part. It is better to set installation path here instead of fiddling around later.

Sample .configure for PHP5:

$prompt: ./configure –with-curl=/usr –with-mysql=/usr/local/mysql –with-apxs2=/usr/local/apache2/bin/apxs

As you can see from –with-apxs2 flag, I installed apache2 on default location. It’s easier to find help and online documentation if you keep most installation on default location, IMHO.

The biggest problem with installing Apache is the httpd.conf monkey work. Below are things you might want to set:

  • Listen 80 (and/or other port number. This is needed for VirtualHost setup)
  • DocumentIndex index.php index.htm (add more if you need them, e.g. index.rhtml)
  • DocumentRoot /Users/{username}/Sites/{your_project} (This path is accessible by default)
  • <Directory /Users/{username}/Sites/{your_project}> </Directory>
  • AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
  • <VirtualHost *:{your port number}> {This tag can handle almost all Apache’s directives} </VirtualHost>

Mac OS X has Apache1.3 by default. That can be seen as both blessing and curse :P. If you would like to run Apache2 this is what you might do:

  • Stop Personal Web Sharing via System Preferences…
  • type: sudo /usr/local/apache2/bin apachectl start

AGAIN and AGAIN… If that aggravates you then this is what you could do:

  • cd /usr/sbin
  • mv apachectl apachectl1.3 {–> This rename default apache1.3/apachectl command}
  • ln -s /usr/local/apache2/bin/apachectl apachectl {–> This creates symlink for Apache2/apachectl command}

Quick Note: Symlink is something like Alias or Shortcut on the GUI realm.

There you have it. Hope the list is handy for you.

OS X as the ultimate Web Dev machine!

April 22, 2007 § Leave a comment

Below are blogs, tutorials, and articles that help me configuring OS X to be the ultimate web development machine:

  1. Before doing anything, first execute command: “periodic weekly”. This allows you to use “locate” command.
  2. Fink! Before installing your favorite Linux tools/packages, get this one first. This app contains apt-get and much more.
  3. While you are installing Fink, why not FinkCommander?
  4. This guy presents dead-on tutorial on how to install Apache, MySQL, & PHP.
  5. This is my take on how to install Apache2 & PHP5.
  6. This guy shares us the joy of Python via this easy, breeze, beautiful blog.
  7. In case you have amnesia, or simply didn’t know SVN… Read this!
  8. What about Text Editor you say?
    • The hardcore side of me says “Use VIM my friend…”
    • The easy-to-use-but-resource-hog side of me says “How about Eclipse?”
    • Though TextMate still rules the realm of Darwinian.

More is coming up, if only I could find some of yesterday’s online tutorials ( hasn’t solved my problem yet).

Where Am I?

You are currently browsing the apache2 category at RAPD.