Skip to content

Instantly share code, notes, and snippets.

@proapi
Last active August 29, 2015 13:57
Show Gist options
  • Save proapi/9833525 to your computer and use it in GitHub Desktop.
Save proapi/9833525 to your computer and use it in GitHub Desktop.
nginx_unicorn #nginx #unicorn #devops #config
upstream padrino {
# Path to Unicorn SOCK file, as defined previously
server unix:/tmp/unicorn.padrino.sock fail_timeout=0;
}
server {
listen 80;
server_name padrino.proapi.eu;
# Application root, as defined previously
root /var/www/padrino/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_pass http://padrino;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/www/padrino/current/public;
}
client_max_body_size 4G;
keepalive_timeout 10;
}
# Set the working application directory
# working_directory "/path/to/your/app"
working_directory "/var/www/padrino/current"
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/var/www/padrino/current/tmp/pids/unicorn.pid"
# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/var/www/padrino/current/log/unicorn.log"
stdout_path "/var/www/padrino/current/log/unicorn.log"
# Unicorn socket
listen "/tmp/unicorn.padrino.sock"
# Number of processes
# worker_processes 4
worker_processes 1
# Time-out
timeout 30
preload_app true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment