Install nginx with Homebrew on Mac OS X

I needed to install nginx to check my last project’s behavior behind a reverse proxy. This post isn’t about how to configure nginx for production – you’ll find that on Google (and you may use Linux over Mac 😉 ). This post is only about the installation part, like the previous ones as a reminder for future me when I’ll make this install again.

Install nginx

brew update
brew install nginx

Check if it works

  • nginx
  • go to http://localhost:8080
  • nginx -s stop

Version your nginx config with git

This part is optional, but it comes very handy to have your nginx folder config versioned, so that you wont have to make *.bak files 😉 …

Don’t worry, versionning the /usr/local/etc/nginx folder won’t mess with your homebrew git repo, if nano /usr/local/.gitignore you’ll see that basically, anything but the Library folder is not tracked.

cd /usr/local/etc/nginx
git init
git add .
git commit -m "original config"

There you are safe, you can mess all you want with your nginx conf …


You’ll find the error and access logs here : /usr/local/var/log/nginx/

You’ll find the file containing the nginx’s pid here : /usr/local/var/run/


Reminder : Homebrew will set the port to 8080 by default in the config so that you could run nginx without sudo. If you bind your server to the port 80, you’ll have to sudo nginx.

One thought on “Install nginx with Homebrew on Mac OS X

  1. I have checked your blog and i’ve found some duplicate content, that’s why
    you don’t rank high in google’s search results, but there is a tool
    that can help you to create 100% unique content, search
    for; Boorfe’s tips unlimited content

Leave a Reply

Your email address will not be published. Required fields are marked *