Created
June 20, 2013 03:14
-
-
Save yctay/5820050 to your computer and use it in GitHub Desktop.
Example nginx/puma conf file.
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 example_name { | |
server unix:///var/www/example_name/shared/sockets/puma.sock; | |
} | |
server { | |
listen 80; | |
server_name example_name.com; | |
root /var/www/example_name/current/public; | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' $http_origin; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' 'Content-Type, Accept'; | |
add_header 'Access-Control-Max-Age' '1728000'; | |
add_header 'Content-Type' 'text/plain; charset=UTF-8'; | |
return 200; | |
} | |
proxy_pass http://example_name; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location ~ ^/(assets)/ { | |
root /var/www/example_name/current/public; | |
gzip_static on; # to serve pre-gzipped version | |
expires max; | |
add_header Cache-Control public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment