so you've sudo port install nginx and everything seemed to go swimmingly. But when you check http://localhost/ in your browser, things don't seem to work. Ugh. Here's the quick list of what you need to do to make it actually work:
  1. Ensure that "Personal Web Sharing" is disabled in system preferences -> sharing. this will turn off apache
  2. make sure you ran sudo port load nginx (running it twice will error but wont hurt anything)
  3. next, you have to set up your nginx.conf -- the easiest way is to copy the example: sudo cp /opt/local/etc/nginx/nginx.conf.example /opt/local/etc/nginx/nginx.conf
  4. we're still not there yet because the default example nginx.conf points to mime.types which doesn't exist. wtf? so, we have to do another move: sudo cp /opt/local/etc/nginx/mime.types.example /opt/local/etc/nginx/mime.types
That should be it. You're probably going to want to create aliases to the following commands to fully stop and start nginx (otherwise the monitoring process will keep bringing it back when you try to shut it down:)
  • sudo launchctl unload -w /Library/LaunchDaemons/org.macports.nginx.plist
  • sudo launchctl unload -w /Library/LaunchDaemons/org.macports.nginx.plist
Try running the stop and start as above and then open up http://localhost/ in your browser. You should see the "Welcome to nginx!" page. Now go build something awesome.