Created
December 23, 2015 03:58
-
-
Save ntamvl/8bcf8ab6c700cca6346d to your computer and use it in GitHub Desktop.
nginx + unicorn + performance tweaks: myapp.conf example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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