Thursday, November 17, 2011

Blog URL migration with GAE redirect with nginx rewrite

I am in the process of migrating a number of applications I used to run on my VPS onto the Google Apps framework, mostly because I am lazy. One such application was this blog. Creating and copying the blog entries across was simple enough, but I also wanted to incorporate my static pages. This would require configuring and to make to my home page on the blog. As an extra step I wanted my VPS server to have as little to do as possible. My plan was to get hosted in the Google Application Engine service then simple do a rewrite for on my VPS.

I created a very simple Go app for GAE mapped to that redirected to my blogs home page.
package page_redirect

import (

func init() {
        http.HandleFunc("/", root)

func root(w http.ResponseWriter, r *http.Request) {
        http.Redirect(w, r, "", 302)

All my VPS needed to do now was redirect web requests for to This was easily achieved by added a simple server configuration to my nginx front end.
server {
    listen 80;
    rewrite ^/(.*) permanent;

And that's it. My blog has now been fully integrated into Google for them to spy on with my blessings.

1 comment:

  1. To do Not Pressure OR Anything, But Have Ever This considered post there is statement PT Lampung Service this is a
    Service HP Bandar Lampung whose looking to do day
    Iklan Baris Lampung to this looking then to out standing that is
    Business Of Luxury Design I will try it.
    Jasa Kursus Service HP They have jumping places and so that the device other kid's activity.Youtuber Lampung ,

    Thanks ! Visit Back Subscribel Here ->Youtuber Lampung <-