Last active
October 6, 2015 15:50
-
-
Save pol/656c200143e46737fa37 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
| server unix:/var/rails/shared/pids/unicorn.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| server_name foo.edu bar.edu; | |
| return 301 https://bar.edu$request_uri; | |
| } | |
| server { | |
| listen 443; | |
| server_name foo.edu; | |
| return 301 https://bar.edu$request_uri; | |
| } | |
| server { | |
| listen 443; | |
| server_name bar.edu; | |
| ssl on; | |
| ssl_certificate /etc/ssh/certs/bar.edu.crt; | |
| ssl_certificate_key /etc/ssh/certs/bar.edu.key; | |
| root /var/rails/current/public; | |
| location / { | |
| try_files $uri $uri/ $uri.html =404; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| proxy_redirect off; | |
| if (!-f $request_filename) { | |
| proxy_pass http://unicorn_server; | |
| break; | |
| } | |
| } | |
| error_page 500 502 503 504 /500.html; | |
| location = /500.html { | |
| root /var/rails/current/public; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment