Skip to content

Instantly share code, notes, and snippets.

@ntamvl
Created December 23, 2015 03:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntamvl/8bcf8ab6c700cca6346d to your computer and use it in GitHub Desktop.
Save ntamvl/8bcf8ab6c700cca6346d to your computer and use it in GitHub Desktop.
nginx + unicorn + performance tweaks: myapp.conf example
# myapp
upstream unicorn_myapp {
server unix:/var/rails/myapp/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
server_name myapp.com www.myapp.com;
root /var/rails/myapp/current/public;
try_files $uri @app;
location @app {
proxy_pass http://unicorn_myapp;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/rails/myapp/current/public;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment