Created
July 30, 2012 14:07
-
-
Save longlongjump/3207113 to your computer and use it in GitHub Desktop.
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 domain1 { | |
server 127.0.0.1:3000; | |
server 127.0.0.1:3001; | |
server 127.0.0.1:3002; | |
} | |
server { | |
listen 80; | |
server_name www.domain.com; | |
rewrite ^/(.*) http://domain.com permanent; | |
} | |
server { | |
listen 80; | |
server_name domain.com; | |
access_log /home/demo/public_html/railsapp/log/access.log; | |
error_log /home/demo/public_html/railsapp/log/error.log; | |
root /home/demo/public_html/railsapp/public/; | |
index index.html; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect false; | |
if (-f $request_filename/index.html) { | |
rewrite (.*) $1/index.html break; | |
} | |
if (-f $request_filename.html) { | |
rewrite (.*) $1.html break; | |
} | |
if (!-f $request_filename) { | |
proxy_pass http://domain1; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment