How to add subdomain pointing to other website on same server - azure

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.

Related

Website in IIS locally and Domain Name bought from GoDaddy - What Next

I have been at this since last couple of weeks. After tiring efforts leading to nowhere, I am posting here.
I have a Website built and hosted in IIS locally. I just bought domain name from GoDaddy. I have my computer's public IP where the website in IIS is present. What are my next steps so that I can keep my computer as server and link with domain name? So that website is accessible publicly through domain name.
I saw a lot of posts with Web Hosting in Azure or other places, do I HAVE TO buy and host to make my site public?
I am a novice website builder and have very limited knowledge about this.
first you need make sure your sever is secured, only open necessary ports
go to another computer, in browser input public ip to see if you can open your webpage
then in Godaddy you can add A record for your domain, to point your domain to your public IP, refer to this GoDaddy document: https://ca.godaddy.com/help/add-an-a-record-19238
If you are not comfortable or don't resource to do these, I suggest you host on Azure or other cloud providers
You could host your application in either Azure VM or your local machine. After all, Could VM should be more convenient because you don't need spend a lot of time to handle network issue and you don't need physical space.
When you decide to host your application locally, you have to ensure your are using windows server OS, otherwise, you have 10 concurrent request limit.
Access the application via domain is quite simple.
You need to enable port like 80 in windows firewall.Promise your server are in DMZ and can be accessed externally
Create IIS binding header with null domain and your public address
Try to access your website via your public IP address
Point godday domain to your public IP address
Add your domain to your Site's binding host header->host name field
If you decide to host your application in IAAS like Azure VM, then you have to create inbound rule for your port number and allow port in windows firewall. You also have to point your godday domain to your cloud VM's public IP address and create IIS binding with your domain. Finally, you should be able to access your website.

Access azure app service with ip address not the hostname

I've got a app plan (BASIC SMALL) with a private (hopefully) ip adress that can be found under Settings > Custom Domains.
When I try to access the content of the app using just the ip, it doesn't work. The site says "Error 404 - Web app not found." The hostname works just fine. When I ping the hostname it gives me the same ip adress. What do I have to do in order to be able to access it just using the ip?
That's not how Web Apps work, since you don't get a unique IP address assigned. You'll need to access it via yourname.azurewebsites.net or yourcustomdomainname.com - and then your requests are routed appropriately based on the name you provide.
If you absolutely needed a dedicated IP address, you'd need to deploy to a virtual machine.
When you host your web site on Azure web app it is bound to a virtual IP address that is shared with other web sites in the same app service plan. If you want to get a dedicated IP with your web site, please try to use Azure virtual machine with reserved IP. You could also choose App Service Environment
If you buy your custom domain, you can freely set DNS A records for that IP (it remains static). It sets binding of your domain to your web app. You can't access it directly by IP. Because on a given IP address and standard HTTP port 80, only one web can be running.
Imagine your web app could be open by entering that IP. You would "block" port 80 for zillions of other stuff running there.
If you check Properties blade there you will see a number of outbound IP addresses. If you consume some requests from web app / job / ... and have IP restriction set on the other side - you need to allow all these IPs.
As David suggested. If you really need a static IP - you need to run VM and set IP address as static or set VNet for web app.

Azure Dns Zone not Resolving on Virtual Machine

On Azure (through portal)
Created Virtual Machine with a Static IP, data disk, and opened ports
Then remote desktop - Install IIS and FTP, ports opened in firewall
(can successfully connect via ftp client)
Created a Public Load Balancer with a Static IP with Probes and Rules
(can connect with ftp client through load balancer ip address fine)
(if I enter ip address of load balancer in browser I can view the default iis website fine) (at moment there is only one vm in virtual machine set)
Added a couple of websites in IIS, one a .net app, and the other with just some hello world .html files to test connectivity via domain name. I set bindings to host name for websites with and without www. and IP address set to all (*). restarted websites.
Created a couple of Azure DNZ Zones with A Records pointing to the Load Balancer IP address. Changed name servers on domain register to point to the azure dns servers.
However, this is where it stops. A browser cannot get to either website and I get a '500' error. dns propogation check tools verify that the nameservers are reaching azure for domain names.
There must be something really basic I am missing (???) It is as if DNS resolution is stopping at the virtual machines. Any suggestions.
If you are Configuring multiple websites in a IIS of VM and also you want to map them for different domain name, then you need to Configure Host Header for all websites in IIS (Please find below links for this) and also need to update same A Record for all your websites at you Domain provider setting.
This will work if you have separate Domain Names registered else it will not work.
Without domain name you can deploy websites on different ports in IIS and then configure custom domain in Azure Load Balancer NAT rules.
Links for Host Header config in IIS
https://technet.microsoft.com/en-us/library/cc753195(v=ws.10).aspx
http://support.simpledns.com/kb/a82/virtual-hosting-with-iis-internet-information-services.aspx
This was my fault in some missing hyphens in the zone record. The other .net website was throwing 500 errors sometimes instead of error-name-not_resolved from incomplete nameserver propogation and incomplete .net configuration for the website on VM
The host headers were set correctly including www.xxx.com and .xxx.com variants for both port 80 and port 443, and I did have the 'A' records with both # and www variants in the zone set to the IP of the load balancer correctly.
For anyone else with these issues, when checking for localhost connectivity test on your virtual machine (assuming you are hosting multiple sites), remember to add a virtual directory in IIS manager pointing to the file location along with an alias.
While a learning curve, the whole infrastructure of Azure is quite amazing! Impressed.

exposing Azure DNS servers

I have an Azure virtual machine with multiple web sites on it that I would like to expose to the Internet. The VM has Active Directory and DNS installed on it. I created the forward zone (xxx.cloudapp.net) on my server, and added the two web site names to the zone. On the Networks in the Management Portal, I added a DNS server(xxx.cloudapp.net) and gave it the public IP for my server.
So when I try a nslookup from outside of the VM, the names will not resolve. I set the server in nslookup to either the public IP or the name, and it does not resolve. I have logging turned on in the DNS server, but it does not seem to show any requests from my computer.
I must be doing something wrong. Any suggestions? This server is for a demo next week, and worst case, I can buy a couple of domain names.
Try the instance level public-ip address, you will get an ip address per virtual server: https://azure.microsoft.com/documentation/articles/virtual-networks-instance-level-public-ip/

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.

Resources