Nginx + Unicorn sample config files
nginx.conf expects that sites-enabled directory (in the same with the config file) had been created.
nginx.conf
user www-data;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server_names_hash_bucket_size 128;
include ./sites-enabled/*;
}
upstream app_upstream {
server unix:/tmp/.unicorn_socket fail_timeout=0;
}
server {
listen 80;
server_name example.com;
error_log logs/com.example-error.log;
access_log logs/com.example-access.log;
root /var/www/com.example/current/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_upstream;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/www/com.example/current/public;
}
}
