I’ve documented two ways of installing Apache. One where the default Apache Snow Leopard install is overwritten with your own version (the Darwin layout). A second one, the DIYMacServer layout, where the default install is left alone completely (it uses the same directory for the webpages, but a different location for the binaries, configuration and logfiles). The difference in the configuration is decided with the '-enable-layout‘ option during configuration. If you choose the Darwin layout Apple’s updates might mess with your setup.

If you select the default Darwin layout skip the next bit until the configuration phase (please note that the rest of the instruction on this site are based on the DIYMacServer layout!) otherwise continue reading.

For the DIYMacServer layout we need to edit some configuration files in the Apache source directory before we can start. First copy the layout below and add it to the ‘config.layout’ file in source directory.

<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/Webserver
  installbuilddir: ${datadir}/build
  errordir: ${datadir}/error
  iconsdir: ${datadir}/icons
  htdocsdir: ${datadir}/Documents
  manualdir: ${datadir}/manual
  cgidir: ${datadir}/CGI-Executables
  includedir: ${prefix}/include
  localstatedir: /var
  runtimedir: ${localstatedir}/run
  logfiledir: ${localstatedir}/log/httpd
  proxycachedir: ${runtimedir}/proxy
</Layout>

Next you need to add the following layout to the config.layout files in these locations:

  • ./srclib/apr/config.layout
  • ./srclib/apr-util/config.layout
<Layout DIYMacServer>
  prefix: /usr/local/apache2
  exec_prefix: ${prefix}
  bindir: ${exec_prefix}/bin
  sbindir: ${exec_prefix}/bin
  libdir: ${exec_prefix}/lib
  libexecdir: ${exec_prefix}/libexec+
  mandir: ${prefix}/share/man
  sysconfdir: /etc/httpd
  datadir: /Library/Webserver
  installbuilddir: ${datadir}/build
  includedir: ${prefix}/include
  localstatedir: /var
  runtimedir: ${localstatedir}/run
</Layout>

If you’ve edited the ‘config.layout’ file to add DIYMacServer (the Darwin layout is already in the file) you are ready to run the configuration script. Change the ‘–enable-layout’ to reflect your choice in configuration. So fill in either DIYMacServer or Darwin to choose, the example uses DIYMacServer as the layout.

./configure -enable-layout=DIYMacServer \
 -enable-mods-shared=all \
 -with-ssl=/usr \
 -with-mpm=prefork \
 -disable-unique-id \
 -enable-ssl \
 -enable-dav \
 -enable-cache \
 -enable-proxy \
 -enable-logio \
 -enable-deflate \
 -with-included-apr \
 -enable-cgi \
 -enable-cgid \
 -enable-suexec

You can now run:

make

and if it all goes well:

sudo make install

If you run into errors which you can’t explain, please post you questions and the error into the forum on this site.