Trevor Turk

A chess-playing machine of the late 18th century, promoted as an automaton but later proved a hoax.

Passenger with nginx on Mac OS X (2nd edition)

This is a fancy new guide for setting up nginx with Passenger support on Mac OS X. You can refer to the first edition here if you like. Let's begin.
  • Install Ruby Version Manager (optional)
  • Install Homebrew
  • Install Passenger
    gem install passenger
  • Install nginx with Passenger support
    brew install nginx --with-passenger
  • Follow the instructions (Caveats) that Homebrew prints out
  • Open your nginx conf file
    mate /usr/local/etc/nginx/nginx.conf
  • Replace the contents of the file with this:
    worker_processes 1;
    
    events {
      worker_connections 1024;
    }
    
    http {
      include mime.types;
      default_type application/octet-stream;
      sendfile on;
      keepalive_timeout 65;
    
      passenger_root /Users/trevorturk/.rvm/gems/ruby-1.8.7-p302/gems/passenger-2.2.15;
      passenger_ruby /Users/trevorturk/.rvm/rubies/ruby-1.8.7-p302/bin/ruby;
    
      server {
         listen 8080;
         server_name eldorado.local;
         root /Users/trevorturk/Code/eldorado/public;
         passenger_enabled on;
         rack_env development;
      }
    }
  • ...then replace the passenger_root config option with your passenger root directory
    passenger-config --root
  • ...then replace the passenger_ruby with your ruby location
    which ruby
  • ...then replace and/or create new server blocks as necessary for your apps
  • Restart nginx
    kill -HUP `cat /usr/local/var/run/nginx.pid`
  • Add your apps to your hosts file
    mate /etc/hosts
    For example...
    127.0.0.1 eldorado.local
  • Visit one of your apps to make sure it's working:
    open http://kzak.local:8080
fin Note that I'm not sure how to get nginx running on port 80, and I'm not bothered enough to figure it out at the moment. Please leave a helpful comment for others if you take the time, though!

« Home page