Install Nginx on Mac OS X 10.6.7

Today , I installed Ubuntu and then install nginx. Nginx installation is very easy in Ubuntu. So, How about in Mac ? It’s also easy to install server. But I still not try to install php or django. Now, I prepare to learn django with Nginx. So, first step, install nginx on Ubuntu.

1. Install PCRE

Download latest PCRE. After download go to download directory from terminal.

$ cd ~/Download $ tar xvzf pcre-8.12.tar.gz $ cd pcre-8.12 $ sudo ./configure –prefix=/usr/local $ sudo make $ sudo install

2. Install Nginx

Download latest nginx from After download, let install

$ cd ~/Download $ tar xvzf nginx-1.0.0.tar.gz $ cd nginx-1.0.0 $ sudo ./configure –prefix=/usr/local –with-http_ssl_module $ sudo make $ sudo make install

3. Add Nginx to PATH

In terminal , $ sudo vi ~/.profile and then config PATH. Add /usr/local and /usr/local/sbin. nginx is already exist in /usr/local/sbin/nginx

export PATH=$PATH:/usr/local:/usr/local/sbin:

Save it. And then repload profile $ source ~/.profile

4. Run Nginx

Ok. Let test nginx. Make sure , there is no MAMP or apache is running.

$ sudo nginx

Let open , http://localhost in your browser and you will see welcome page. If you want to stop nginx

$sudo nginx -s stop

5. Config localhost

I want to create a new localhost path for nginx. So, I create a new directory in home path.

$ mkdir ~/localhost $ sudo vi index.html

and then add some words.

$ sudo vi /usr/local/conf/nginx.conf

change root

server {         listen       80;         server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {

            root   /Users/saturngod/nginx/localhost;

            index  index.html index.htm;


$ sudo nginx -s stop $ sudo nginx

and then run again from browser. You will see your index.html.

comments powered byDisqus