These are the steps I followed to create a Linux VM on Windows Azure, install nginx and Go on it and serve up a "Hello World" app using FastCGI.
First, I signed up a 3-month trial account on Windows Azure - you will need a Microsoft Account for this.
Next, I created a new Virtual Machine using New -> Compute -> Virtual Machine -> From Gallery.
I selected Ubuntu Server 12.04.1 -
I gave the new VM a name - GoMachine, selected a username and password and hit Next -
Choose Availability Set as None -
Once the VM was provisioned, I SSH'd into it using PuTTy using the credentials I had set earlier -
I installed Go using the command - sudo apt-get install golang-go.
I installed nginx using the command - sudo apt-get install nginx.
Next, I created a directory called fcgi in which I created a file - fcgi.go -
and compiled it using go build fcgi.go.
I edited the file /etc/nginx/sites-available/default to allow it to serve FastCGI and pointed it to 127.0.0.1:9999 where the fcgi app will listen. The server will also take requests directed to http://gopher.cloudapp.net.
I started the fcgi application using ~/fcgi/fcgi& to run it in the background. I also restarted nginx using sudo service nginx restart for the new configuration to take effect.
To test the app, I typed curl http://localhost/hello. It worked. However, curl http://gopher.cloudapp.net/hello didn't. To make this work, I had to create a new 'endpoint' for the VM in the dashboard -
I clicked on Add Endpoint, and created a new TCP endpoint on Port 80 -
Now, the web app is accessible from the outside world.
Update: - My 3 month trial has expired. So the above URL is not accessible any longer.