Last active
August 18, 2020 18:41
-
-
Save beglov/e9174f3f761029d19b0357917994078f to your computer and use it in GitHub Desktop.
Nginx config for rails app with Unicorn
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
upstream unicorn { | |
server unix:/home/deploy/tms/shared/tmp/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name ec2-3-134-77-212.us-east-2.compute.amazonaws.com; | |
root /home/deploy/tms/current/public; | |
access_log /home/deploy/tms/current/log/nginx.access.log; | |
error_log /home/deploy/tms/current/log/nginx.error.log; | |
client_max_body_size 20M; | |
location ^~ /assets/ { | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
try_files $uri/index.html $uri @unicorn; | |
location @unicorn { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://unicorn; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment