Host a web site in an Azure VM - azure

I have a Azure VM. Using the IIS, I host a website in the VM.
How can I access that website via the DNS name (like http://abc.cloudapp.net/)
I know this is the most unlikely, we should use the "web role", but I really need this works, is this possible?
I tried with the localhost, it works, the internal IP works, but the DNS name doesn't.
Edited to provide more info (March 09):
I have already have endpoints setup. "binding" uses the dns name. I have two website, one hosted in the port 8081, it works. Another one hosted in the port 80, which doesn't work.
http endpoints
the port 80 doesn't work
the port 8081 works

If I understand correctly, your VM already has a Azure domain in the form of myvmname.cloudapp.net right?
First you need to add an ENDPOINT in the VM that bridges the port 80 from outsite to inside (if that is the port indeed you configured in IIS).
Then, you need to add a CNAME record in your DNS table that points from www.mydomain.ext to myvmname.cloudapp.net (obviously replacing the correct values).

Related

How to add subdomain pointing to other website on same server

I have 2 websites I want to run on one virtual machine.
One is a NodeJS server, the other an Nginx server.
The main website website.example points to the NodeJS server.
Now I want a subdomain like shop.website.example to point to the Nginx server.
The virtual machine is in Azure.
I've read that it's not possible to link a subdomain to a specific port, so that's already not possible.
Would it be possible to have different IP's that go to the website, and would route to the right server based on the IP that is being used?
As far as I know, if you want to access the two websites in the same Azure VM, It's possible to use two DNS records to map to your Azure VM.
First of all, the two websites should listen on different ports. Then you can use A record to map the domain name website.example to the Azure VM public IP address. A CNAME record maps the subdomain name shop.website.example to the Azure VM FQDN. You should bind the different hostname of the websites with different ports on the Azure VM.
Also, make sure you could access the website outside of Azure. You could check the NSG rule or local firewall or website is listening for 0.0.0.0 on the Azure VM.

IIS 10 new website with custom port number can't be accessed from Internet

So I deployed a new website in IIS 10 with port number 8888 (the Default Web Site uses port 80).
I can successfully browse the website locally on the server. However, I can't visit it from another PC using Internet. The browser complains 'Hmmm.. can't reach this page'.
The firewall on server has been manually shut down.
I also checked that port 8888 is listening on my server.
Did I miss any steps here?
All right, I got it work... Turns out the cloud service that I use shut down accesses to almost all ports except port 80 by default... After I open port 8888 on the cloud settings, everything works.
Actually #NJUHOBBY is right, I use Google Cloud and I had to go over
Google Cloud Console -> VPC Networks -> Firewall Rules -> Create Firewall Rule
...to create a new rule. Please be aware that Firewall Rules are applied to VM through TAGS, so if you choose to use https-server tag this rule will apply to all your VM's (this is tag is assigned to all server instances by default). In my case I set a custom tag and then I added this tag to my VM like this:
Compute Engines-> VM Instances.
Then I clicked my server's vm name and clicked Edit then I added the custom tag in the appropriate field. After saving VM's properties, the port was successfully opened.

Azure VM IIS unreachable from public IP / cloudapp.net domain

I just setup a Windows Server VM on my Azure space, but for some reason the IIS that is configured on it isn't available publicly...
I can open the IIS welcome page trough localhost on the server, but no trough visiting the external IP or the cloudapp.net domain.
Something to note is that I actually CAN reach the server trough MSTSC with the external IP adress...
I tried:
Shutting off the Windows Firewall
Opened endpoints on the non-classic management Azure system
I binded the ip's to the cloudapp host
Checked the online Azure documentation
So I resolved it... Don't know if it's supposed to be that way, but be sure that in Azure your "Source port" is defined to be * and not 80, or other.
That will absolutely not work if you're not defining "*".
Screenshot of Azure here

Can a managed website and a virtual machine share the same domain name in Azure?

I have a website hosted on Azure as a managed site. I need to run a separate FTP server and a custom Windows service on virtual machine, but need them to share the same domain name as the site. So what I'd like to be able to do is have mysite.com port 80 go the website, but mysite.com port 21 etc go the virtual machine and connect with the FTP service. How would I go about setting that up?
When a user looks up "mysite.com" they are going to get a single IP address, and there is no way via DNS to return different IP addresses based on the port number you are trying to use. You have a couple options to achieve this solution:
Setup an intermediate routing service that accepts all traffic to mysite.com and then routes the traffic to the appropriate website/VM based on the port number. This is non-trivial and may incur extra costs (you could build the routing service into the existing VM that is serving FTP to reduce the cost).
The easier solution is probably to have a CNAME for www.mysite.com pointing to the website, and a CNAME for ftp.mysite.com pointing to the VM.

Can't get Azure Virtual Machine to serve websites

I've just set up a windows azure VM and installed IIS on it.
When I remote desktop onto the box I can see the default IIS website fine but I can't get this to serve on the web from the IP address of the box.
I've opened up port 80 on windows firewall and also added an endpoint for port 80.
I've tried to access it with the firewall completely turned off also but to no avail...
I cant work out if there is anything else I need to do to get this working?
Add endpoints for port 80 (http) and port 443 (https) to the VM in the Azure portal (tip: this can be automated with powershell or the Azure cli).
Remote desktop to the machine. Open the Windows firewall control panel and allow traffic to port 80 (http) and port 443 (https) or just turn it off ... the firewall is ON by default (tip: can also be scripted through the VM agent / powershell).
Go to the Azure portal and find the cloudapp.net subdomain for your VM (actually the cloud service) your VM is running under. Try accessing the site with that domain. If that doesn't work, try browsing to http://localhost on the server (remote desktop) to make sure IIS works and troubleshoot from there.
Modify the DNS records of your custom domain to use a CNAME to the .cloudapp.net domain. If you need A records make sure to use the public IP of the cloud service (just ping the .cloudapp.net domain to find it or look in the Azure portal).
You might want to look into Azure Websites or Azure Cloud Services (web roles). Those are a lot easier to manage and a lot cheaper. They still offer most of the functionality.
What fixed the issue for me was to go into the Azure Portal, browse to 'Network Security Groups', select the VM and then create an inbound rule to allow traffic to port 80.
Note: Also ensure that the inbound rule to port 80 is added and enabled on the actual VM.
Well, I deleted the existing VM and Cloud service and started again - all worked fine out of the box this time.
How annoying! The only thing I did notice was that before my cloud service had the same name as my VM - this time they had different names so that might have been what was causing the issue.
Cheers
For the newer VMs and pre-configured setups (2015+), it's possible your setup is using an azure asset called "Public IP". If so, you can set a custom DNS name label in it, inside "Configuration". Note that this name will consider any type of region used when creating the VM (e.g. my-site.brazilsouth.cloudapp.azure.com).
It's good to remember that for testing purposes, it still suffices to use the value of the public IP that is randomly designated to you.
The VMs are actually accessed via a Cloud Service (well they are for me). Azure created a Cloud Service automatically to be the scaling engine/load balancer on the front of the VM. I have to connect to the web site via that cloud service, not the VM directly.
Its possible you were using the internal IP rather than the external IP.
The sites have to use the internal IP address in the bindings section of IIS. However, in your dns you will need to use the external IP. This is presumably since the 'internal IP' is just a virtual one that Azure uses to map traffic from the external network to the VM's inside azure.
You should find both the internal and external IP's are visible on the VM's desktop.
Switch off TLS 1.3 in the Registry Editor.
This is what worked for me as of writing this in Mar 2021.

Resources