19th June 2012, updated:1st July 2012

Installing Nginx in Os X

Currently, last stable Nginx version is 1.2.1, download available at http://nginx.org/en/download.html

By default, it requires PCRE (Perl compatible regular expressions), which is -at least on Snow Leopard- partially available in /usr/lib. But without a full install, nginx will not compile.

So, the first step is to download PCRE from http://www.pcre.org/ (current version: 8.30), and expand it, let's say, to /tmp/pcre-8.30

Download then Nginx, expanding it, let's say, to /tmp/nginx-1.2.1

To install Nginx in /usr/local/nginx, do:

cd /tmp/nginx-1.2.1
./configure --with-http_ssl_module --with-pcre=../pcre-8.30 --with-pcre-jit --with-http_ssl_module
make
sudo make install

To install it in another location, add the option --prefix=target to the second line above (./configure --prefix=/target ...)