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.
brew update brew install nginx
Check if it works
- 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 :
You’ll find the file containing the nginx’s pid here :
- Installation made with nginx 1.6.2 on OS X 10.10.2
- Configuration templates (can be usefull)
- Nginx documentation
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