Created
October 9, 2014 03:52
-
-
Save hecbuma/dc99161fa68af8b4d1c9 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_spree { | |
server unix:/tmp/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
client_max_body_size 4G; | |
server_name _; | |
keepalive_timeout 75; | |
root /app/public; | |
if ($host ~* ^www\.(.*)) { | |
set $host_without_www $1; | |
rewrite ^(.*) http://$host_without_www$1 permanent; | |
} | |
if (-f $document_root/system/maintenance.html) { | |
return 503; | |
} | |
error_page 503 @maintenance; | |
location @maintenance { | |
rewrite ^(.*)$ /system/maintenance.html last; | |
break; | |
} | |
location / { | |
# Requests for product_info.* to /products | |
rewrite ^/product_info.(.+) /products permanent; | |
# Requests for login.* to /signin | |
rewrite ^/login.(.+) /signin permanent; | |
# Requests for StyleResponsibly.* to wordpress site | |
rewrite ^/StyleResponsibly.(.+) http://myapp.cc; | |
# Requests with .html to wordpress site | |
rewrite ^(?!(/system/maintenance))(/.+).html http://myapp.cc; | |
# Requests for .php to wordpress site | |
rewrite ^(/.+).php http://myapp.cc; | |
proxy_read_timeout 60; | |
proxy_connect_timeout 60; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
# Render 404 to spoof gainspan client | |
location /gsclient.html { | |
return 404; | |
} | |
if (-f $document_root/$uri/index.html) { | |
rewrite (.*) /$1/index.html break; | |
} | |
if (-f $document_root/$uri.html) { | |
rewrite (.*) /$1.html break; | |
} | |
if (!-f $request_filename) { | |
proxy_pass http://unicorn_spree; | |
break; | |
} | |
} | |
location ~* ^/assets { | |
expires max; | |
add_header Cache-Control public; | |
break; | |
} | |
error_page 500 502 503 504 /500.html; | |
location = /500.html { | |
root /data/spree/current/public; | |
} | |
} | |
server { | |
server_name market.myapp.cc; | |
rewrite ^(.*)$ http://myapp.cc/products permanent; | |
} | |
server { | |
server_name community.myapp.cc; | |
rewrite ^(.*)$ http://myapp.cc$1 permanent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment