Unpack the downloaded archive and edit the files ‘config.layout’ you will find there in the following locations:

  • ./config.layout
  • ./srclib/apr/config.layout
  • ./srclib/apr-util/config.layout

Add the following lines to the file at the bottom:

<Layout DIYMacServer>
  prefix: /usr/local/apache2
  exec_prefix: ${prefix}
  bindir: ${exec_prefix}/bin
  sbindir: ${exec_prefix}/bin
  libdir: ${exec_prefix}/lib
  libexecdir: ${exec_prefix}/modules
  mandir: ${prefix}/man
  sysconfdir: /etc/httpd
  datadir: /Library/Documents
  installbuilddir: ${datadir}/build
  errordir: ${datadir}/error
  iconsdir: ${datadir}/icons
  htdocsdir: /Library/WebServer/Documents
  manualdir: ${datadir}/manual
  cgidir: /Library/WebServer/CGI-Executables
  includedir: ${prefix}/include
  localstatedir: /var
  runtimedir: ${localstatedir}/run
  logfiledir: ${localstatedir}/log/httpd
  proxycachedir: ${localstatedir}/proxy
</Layout>

When you saved the additional Layout which defines what goes where you’re ready to continue. I’ll explain what we have defined here, in this layout we decide what goes where when you install Apache. The software (binaries and such) go into ‘/usr/local/apache2‘. All the log-files go into ‘/var/log/httpd‘. The runtime dependancies (like the pid file) go into ‘/var/run‘ and I’ve decided to re-use the original Mac OSX directories for the websites and the CGI files. They will end up in ‘/Library/WebServer/

Open a Terminal session enter the directory in which you extracted the archive and edited the ‘config.layout’. Use a normal user to execute the following the commands, please note difference for Intel or PowerPC based Mac’s:

For Intel:
CFLAGS=”-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk” \
./configure -enable-layout=DIYMacServer \
 -enable-mods-shared=all \
 -with-ssl=/usr \
 -with-mpm=prefork \
 -enable-ssl \
 -enable-dav \
 -enable-cache \
 -enable-proxy \
 -disable-unique-id \
 -enable-logio \
 -enable-deflate \
 -with-included-apr \
 -enable-cgi \
 -enable-cgid \
 -enable-suexec

For PowerPC:
CFLAGS=”-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk” \
./configure -enable-layout=DIYMacServer \
 -enable-mods-shared=all \
 -with-ssl=/usr \
 -with-mpm=prefork \
 -enable-ssl \
 -enable-dav \
 -enable-cache \
 -enable-proxy \
 -disable-unique-id \
 -enable-logio \
 -enable-deflate \
 -with-included-apr \
 -enable-cgi \
 -enable-cgid \
 -enable-suexec

and follow with:

make

If these processes end without error you are ready to install Apache. To make sure you get the new version 2 configuration set please copy the original configuration to a safe place using:

sudo mv /etc/httpd /etc/httpd.org

Then complete the install using the following command:

sudo make install

Apache is now installed in ‘/usr/local/apache2‘, your websites html and php should be located in ‘/Library/WebServer/Documents‘. You can configure your web server with the ‘httpd.conf‘ located in ‘/etc/httpd

To start the new webserver, make sure the default Mac OS X version is turned off, use:
sudo /usr/local/apache2/bin/apachectl start

Next step: Configuring Apache on Tiger