Comments
-
Greg Hurrell
Ok, I have a plan of action now.
First step already initiated: updating the
CNAME
aliases in the wincent.dev zone that currently point to "wincent.dev" itself to beA
records that reference the actual IP address instead. I'll be changing "wincent.dev" to point to another IP at a later time, but I want all the existing subdomains to continue with the current IP. -
Greg Hurrell
DNS changes completed.
-
Greg Hurrell
Some nice things:
- Anything currently hosted via HTTPS at wincent.dev won't need to be brought over (different IP address, everything will keep working just fine
- Any access via the "rails" subdomain won't need special handling; only access via "wincent.dev"
- Any access via HTTPS to "wincent.dev" won't need special handling; all old URLs there were served over HTTP anyway
So basically we need to implement special forwarding if and only if access is over HTTP/port 80, and the host name is "wincent.dev".
And really, everything we care about there is rooted under
/a/
, making for an easy check. Here's the full list of stuff in thepublic_html
directory of wincent.dev right now:drwxr-xr-x 13 wincent.dev wincent.dev 4096 Mar 29 2008 a drwxr-xr-x 2 wincent.dev wincent.dev 4096 Jul 12 2006 contact -rwxr-xr-x 1 wincent.dev wincent.dev 12533 Jun 9 2008 download.php -rw-r--r-- 1 wincent.dev wincent.dev 318 Nov 20 2004 favicon.ico drwxr-xr-x 2 wincent.dev wincent.dev 4096 Aug 7 2005 files drwxr-xr-x 2 wincent.dev wincent.dev 4096 Jan 19 2006 gfx -rw-r--r-- 1 wincent.dev wincent.dev 178 Nov 20 2004 global.inc.php drwxr-xr-x 2 wincent.dev wincent.dev 4096 Mar 29 2008 gpl drwxr-xr-x 3 wincent.dev wincent.dev 4096 Sep 19 2007 images -rw-r--r-- 1 wincent.dev wincent.dev 325 Nov 23 2004 index.php drwxr-xr-x 2 wincent.dev wincent.dev 4096 Apr 7 2007 lgpl drwxr-xr-x 3 wincent.dev wincent.dev 4096 Jan 10 2008 mirror -rw-r--r-- 1 wincent.dev wincent.dev 23 Nov 20 2004 robots.txt drwxr-xr-x 9 wincent.dev wincent.dev 4096 Mar 15 2007 s drwxr-xr-x 4 wincent.dev wincent.dev 4096 Mar 23 2007 synergy drwxr-xr-x 2 wincent.dev wincent.dev 4096 Mar 30 2008 webmail -rw-r--r-- 1 wincent.dev wincent.dev 2390 Jul 10 2007 wincent_colaiuta.pgp.txt drwxr-xr-x 2 wincent.dev wincent.dev 4096 Dec 8 2006 xml-schema
-
Greg Hurrell
Ok, I've made some changes to the staging environment to see if this is going to work.
Basically:
+ root /path/to/wincent.dev/public_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 wincent.dev; + proxy_max_temp_file_size 0; + + if (-f $request_filename) { + proxy_pass http://apache; + break; + } + if (-d $request_filename) { + proxy_pass http://apache; + break; + } + rewrite ^/(.*) https://staging.example.com/$1 permanent; + }
So:
- we only test on port 80.
- if a matching file or directory exists under the Apache root for wincent.dev, proxy the request to Apache.
- everything else is redirected to port 443.
- port 443 handling remains unchanged (nginx proxies to mongrel).
-
Greg Hurrell
Ok, I've made the same changes for the production environment and I've requested that an update be made to the DNS records.
Note that
root_url
in Rails app will continue to be served by mongrel/Rails, because from inside the Rails app we're always talking over HTTPS and the proxying of/
to Apache will only happen when we're accessing over HTTP.Once the DNS changes go live will need to update my
app_config.yml
so that outgoing emails use the shorter wincent.dev hostname instead of the rails subdomain. -
Greg Hurrell
Will also need to update my SSL certs once the changes go live (the rails subdomain IP is currently using the rails subdomain cert, but once wincent.dev starts as the front end of the app I'll need to swap in the wincent.dev cert).
Will probably also want to set up the rails subdomain to listen on another IP so that I can have a valid cert for that as well (can only have one valid cert per IP).
-
Greg Hurrell
Ok, the DNS changes have gone live. Notice published to front page in this article.
-
Greg Hurrell
app_config.yml
now updated too. -
Greg Hurrell
Status changed:
- From: Open
- To: Closed
Add a comment
Comments are now closed for this issue.