Installing Apache 2.2.3 on Intel-based Mac
December 12th, 2006
For me main reason of updating built-in version of Apache (1.3.33) was stable proxy support in new version. Proxy support for running Mongrel web server behind. And Mongrel for running Rails applications. :)
You can check you current version by typing following command in Terminal:
httpd -V | grep version
The target computer is Intel-based iMac Core 2 Duo with Mac OS X 10.4.8. To use 64-bitness of processor and OS let’s export useful CFLAGS. Add this to your ~/.bash_profile which means that your architecture is 64-bit ant you’d like to compile Universal binaries.
export CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
Latest version of Apache is always here: http://httpd.apache.org/download.cgi. Today is December 12 and latest version is 2.2.3.
Preparing, downloading and untargzipping.
cd
mkdir -p distr/src
cd distr/src
curl -O http://www.apache.org/dist/httpd/httpd-2.2.3.tar.gz
tar zxvf httpd-2.2.3.tar.gz
cd httpd-2.2.3
Note: -O after ‘curl’ is a big [ou] not a zero.
Let’s configure! In my case Apache with dependent libraries will be installed in /usr/local so it wouldn’t interfere with built-in version. Add /usr/local/bin to your path before /usr/sbin so by default new Apache binaries will be used.
Apache 2.2.3 requires apr version 1.2. Check your version of apr. In my case it was 0.9.12.
locate bin/apr
./apr-config --version
Note: if your ‘locate’ doesn’t work, apr is probably here: /usr/local/apr/bin
If your version below 1.2, install fresh apr and apr-utils from Apache sources. In my case Apache with dependent libraries will be installed in /usr/local so it wouldn’t interfere with built-in version.
# assuming you are in a httpd-2.2.3 sources directory
cd srclib/apr
./configure --prefix=/usr/local/apr-httpd/
make
sudo make install
# assuming you are in a httpd-2.2.3 sources directory
cd srclib/apr-utils
./configure --prefix=/usr/local/apr-util-httpd/ \
--with-apr=/usr/local/apr-httpd/
make
sudo make install
And finally configuring, making and installing Apache. With suexec, rewrite and proxy support.
./configure --prefix=/usr/local \
--with-apr=/usr/local/apr-httpd/ \
--with-apr-util=/usr/local/apr-util-httpd/ \
--sysconfdir=/etc/httpd
--enable-suexec \
--with-suexec \
--with-suexec-bin=/usr/local/bin/suexec \
--with-suexec-caller=webadmin \
--with-suexec-docroot=/home/webadmin \
--with-suexec-userdir=/ \
--with-suexec-logfile=/var/log/httpd/suexec.log \
--with-suexec-uidmin=500 \
--with-suexec-gidmin=500 \
--enable-rewrite \
--enable-proxy \
--enable-proxy-http \
--disable-ipv6
make
sudo make install
Add /usr/local/bin to your path before /usr/sbin so by default new binaries will be used. Put this in your ~/.bash_profile
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
To simplify Apache control add following aliases to your ~/.bash_profile
alias a1='sudo apachectl start'
alias a0='sudo apachectl stop'
alias a2='sudo apachectl restart'
If you’d like to know more details, let me know in comments.
