How To Create / Setup A Websites On Microsoft Azure VM Using IIS
In the pervious article "Why I Chose Microsoft Azure VM Over Azure Website And Azure Cloud Services To Host My Websites", I had decided to go with Microsoft Azure VM & IIS for hosting my websites as it gives me more control and power. In this article we will about how to use Virtual Machine and IIS to Host Websites On Microsoft Azure.
In case you have not already setup your VM, To help setup your VM read these articles "Microsoft Azure Create Virtual Machine From Microsoft Azure Management Portal" or if you would like to use to creae your VM from Visual Studio read this article "Microsoft Azure Create Virtual Machine From Visual Studio" .
Prerequsite for this artilce is iis should be already installed on your VM. You can refer this article Installing IIS FTP On Microsoft Azure VM to guide you setup iis on microsoft azure.
Open Server Manager and select Internet Information Services (IIS) Manager from the tools menu.
Testing To See If IIS Is Configured And Working Properly
You could enter the public ip address and cheeck if you could see an html page, in the sceen below the default iis page is displayed. To point your domain to Microsoft Azure VM you need to modify the A record in your Domain Name Server (DNS). In my case my domains are registered with godaddy I have added public IP I got from VM details page in Azure Management portal to A records in my DNS settings in godaddy. If your domain is already pointing to Microsoft Azure you could just type the domain name to see if IIS is working.
Adding Website To IIS
From the left side panel connections expand and select sites. Right click on sites and select add websites
Enter the name I have entered website name so that its easier to organize, you can use any name it would not make any difference Add path to the directory where your files are stored enter host name, I have entered www.zipcodepincode.com later I will add zipcodepincode.com without the www
Testing To See If Website Is Working
Go go the browser and type the website name www.zipcodepincode.com to see if its working . Dont forget the www we have not configured domain without wwww yet. If you get a 403 error thats because you dont have any Html files or other application files in the directory.
Adding Html File
I have added a simple index.html files
Adding Host Name Without WWW
On the actions panel on the right select bindings. Click on add type in the hostname without www and click on ok. We add both www.yourhostname.com and yourhostname.com to bings to make sure that both are pointing to the right website in IIS.