Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# example config from a nginx + unicorn + capistrano deploy to a VPS
# "app" is deployed to /var/www/app
# replace "app" with the app name
# The rule of thumb is to use 1 worker per processor core available,.
# however since we'll be hosting many apps on this server,.
# we need to take a less aggressive approach
worker_processes 2
# We deploy with capistrano, so "current" links to root dir of current release
working_directory "/var/www/app/current"
# Listen on unix socket
listen "/tmp/", :backlog => 64
#listen 8080, :tcp_nopush => true
timeout 30
pid "/var/www/app/current/tmp/pids/"
stderr_path "/var/www/app/current/log/unicorn.log"
stdout_path "/var/www/app/current/log/unicorn.log"
preload_app true
GC.respond_to?(:copy_on_write_friendly=) and
GC.copy_on_write_friendly = true
before_fork do |server, worker|
defined?(ActiveRecord::Base) and
after_fork do |server, worker|
defined?(ActiveRecord::Base) and
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment