Hosting website on Azure Virtual Machine

18,478

Solution 1

For reference, I just tested this sequence and it gives you a website accessible over the Internet:

  • Create a new Windows Azure virtual machine with the Windows Server 2008 R2 SP1 image.
  • Add an endpoint on public port 80, private port 80.
  • While the endpoint is being created, start setting the server up.
  • Remote Desktop in.
  • Add the Web Server (IIS) role with default settings.
  • Test the connection. You should get a HTTP 200 OK status.

If you want to troubleshoot your server, start checking for errors in the event log. Check also the website bindings in IIS (Port 80, IP Address *).

Also consider the connection issue might be on the client (your) side. For instance, DNS caching. Try connecting from another machine with direct Internet connection (such as another cloud server) or from a service such as isup.me.

Additionally, if all you want is to host websites in IIS, the Web Sites service has a more streamlined experience.

Solution 2

You will need to create an endpoint on port 80 thru Windows Azure Management portal as well. This endpoint opens a port in the Windows Azure Load-balancer. Navigate to your VM within the portal and create a new Endpoint under the Endpoints screen of VM configuration within Azure management portal.

Share:
18,478
Rob Bowman
Author by

Rob Bowman

Updated on July 19, 2022

Comments

  • Rob Bowman
    Rob Bowman almost 2 years

    Yesterday I created an Azure Virtual Machine using the simple Win2008r2 + SQL2008r2 image.

    I have deployed a website to the VM via an RDP session.

    I am able to browse the website locally (via RDP) using

    "http://localhost"
    

    I understand that I need to add an Azure endpoint for port 80 to enable me to browse to the site from an external machine.

    enter image description here

    I have configured the Windows Firewall on the Azure VM to allow traffic on Port 80 inbound and outbound.

    Could anyone please advise what I've missed or what I can do to troubleshoot?

    ---Update-----

    I have learned a little more this morning. The website that I'm trying to host on the VM is an installation of Interwoven Teamsite v7.3.x. When I looked in IIS I could see that the "Default Web Site" was stopped. Another website called "TeamSiteSitePubPreview" had been created but was only bound to port 81.

    So, what was presenting the website I could see when I browsed to

    http://localhost locally?
    

    I ran netstat -ano and this showed me that PID 1604 what listening on port 80. I then ran Process Explorer which told me that PID 1604 was allocated to "Appache HTTP Server".

    I know nothing about About Appache, can anyone tell me if there's some Apache config that will be preventing connections from outside of the local server?

  • Rob Bowman
    Rob Bowman almost 11 years
    Thanks for your advice Fernando but I'm afraid I still get the same problem. The URL I'm using from my desktop PC (and a colleagues from their home network) is teamsitepoc.cloudapp.net. I can't see anything of value in the IIS logs or anything from eventvwr. Azure websites is not an for what I need the VM for.
  • Fernando Correia
    Fernando Correia almost 11 years
    I see you updated your question to add that you're running the Apache web server. Given you have configured the endpoint in Azure and the inbound firewall rule in Windows, it is probably a misconfiguration in Apache, either in the virtual host or the binding. I'll try to help you there. Please update your answer with relevant portions of your httpd.conf and other Apache configuration files. Also, are you using Virtual Hosts?
  • Rob Bowman
    Rob Bowman almost 11 years
    I hope to look into the Apache config on Tuesday. As a test (to prove all was good when using IIS), I created a simple "hello world" website in IIS bound to port 82 and added an azure endpoint for port 82. I can also browse to this locally (localhost:82) but not from an external machine ( teamsitepoc.cloudapp.net:82). It may be helpful if there were some kind of log at the Azure load balancer / switch level I could check to discover what it's doing with the failed requests?
  • Fernando Correia
    Fernando Correia almost 11 years
    Just to check, you also opened inbound TCP port 82 in the Windows firewall, right? And the IIS website has to be bound to the interface (Address *).
  • Rob Bowman
    Rob Bowman almost 11 years
    Doh! I forgot to open the firewall for Port82. Thanks very much - I have now proved the problem is caused by the apache config, not Azure.