How to set up subdomains on IIS 7 - asp.net

I have a website sitting on an IIS 7 server:
WWW.example.COM
I would like to create several sub domains that looks like
SUBDOMAIN1.example.COM
I created an IIS website and I set the bindings to be
http, port 80, the ip address of my server, and SUBDOMAIN1.example.COM and the physical path to a folder under example.COM
I restarted my website and clicked on browse, the browser than opened with the address:
http://SUBDOMAIN1.example.COM
But the website doesn't show up.
Do I have to do something with the DNS?

This one drove me crazy... basically you need two things:
1) Make sure your DNS is setup to point to your subdomain. This means to make sure you have an A Record in the DNS for your subdomain and point to the same IP.
2) You must add an additional website in IIS 7 named subdomain.example.com
Sites > Add Website
Site Name: subdomain.example.com
Physical Path: select the subdomain directory
Binding: same ip as example.com
Host name: subdomain.example.com

Wildcard method: Add the following entry into your DNS server and change the domain and IP address accordingly.
*.example.com IN A 1.2.3.4
http://www.webmasterworld.com/microsoft_asp_net/3194877.htm

If your computer can't find the IP address associated with SUBDOMAIN1.example.COM, it will not find the site.
You need to either change your hosts file (so you can at least test things - this will be a local change, only available to yourself), or update DNS so the name will resolve correctly (so the rest of the world can see it).

As DotNetMensch said but you DO NOT need to add another site in IIS as this can also cause further problems and make things more complicated because you then have a website within a website so the file paths, masterpage paths and web.config paths may need changing. You just need to edit teh bindings of the existing site and add the new subdomain there.
So:
Add sub-domain to DNS records. My host (RackSpace) uses a web portal to do this so you just log in and go to Network->Domains(DNS)->Actions->Create Zone, and enter your subdomain as mysubdomain.domain.com etc, leave the other settings as default
Go to your domain in IIS, right-click->Edit Bindings->Add, and add your new subdomain leaving everything else the same e.g. mysubdomain.domain.com
You may need to wait 5-10 mins for the DNS records to update but that's all you need.

Related

Create a subdomain and point it to domain location

So I have a follow up question based on How To Setup Subdomains on iis
I am using IIS 8, and I am looking to point my subdomain to my current default website. Currently we have www.mydomain.com, and I setup a subdomain in our DNS A Record that is account.mydomain.com pointing to the same IP address of mydomain.com.
I figured the way to create the subdomain is now to go to Site Bindings under the Default Website in IIS and add a site binding with the hostname account.mydomain.com but I am getting an error that says the server IP address cannot be found. The reason I didn't want to create a new Site in IIS is because we have certain properties and permissions that are setup.
Eventually we will be changing the IP Address of www.mydomain.com to be pointing to something new, but for the time being we need account.mydomain.com to point to the same location as www.mydomain.com
Images for reference -

How do I point my domain to my website that's hosted on an AWS EC2?

The registrar for my domain is godaddy, I go to their DNS records section and I changed the A name to the elastic IP associated with my instance. Now when I type my domain in the browser, my website appears! However, it forwards it to the IP of my server.
Things I've tried (whether logical or not):
I'm using wordpress multsite so I changed the DOMAIN_CURRENT_SITE in wp-config.php to my new domain. No luck. Reverted.
I changed the 'site_url' and 'home' in my database to point to my domain. No luck. Tried one at a time etc. Reverted.
Changed ServerName to my new domain in httpd.conf (apache).
sudo hostname www.... (don't know what that does)
So I'd like to simply have my website open without it showing the IP in the address bar. Can someone help?
Thanks
EDIT:
Here's the DNS page of godaddy, I've blanked out the ip in the A records, but it's just the ip of my server.
First you need to set Custom NS in godaddy with AWS dedicated IPs then set them as DNS. If you are using Linux instance with cPanel then just add the domain in cpanel's addon-domain.
If you are using Windows instance then you should configure IIS.

Different output for http and www versions

I have a domain ie: foo.com
when i type http://foo.com , it goes to my app.
When i type www.foo.com it goes to default IIS page.
I am using plesk 9 for windows.
When i use nslookup to look up DNS they both point to same DNS.
In the IIS application go to bindings, and make sure BOTH www.yourdomain.tld as well as yourdomain.tld are binded. (PS. This question might have been better off at serverfault.com)
If the two domains points to the same IP address, it seems you need to properly configure the Host Headers of your IIS server.
Using Plesk, i think you just have to add a proper alias in the domain management page.
Changes which made in domain's configuration directly in IIS(not via Plesk) will be reset in future(after domain configuration update in Plesk)
In Plesk 9 you can switch on 'www' for domain on Hosting settings page, there is check box "WWW prefix" from left of domain name.

IIS7 - How do I use the same physical path for different domains?

I have two domains:
principal.com
copy.com
When someone type copy.com I want the user to see principal.com contents but whithout redirecting him to that domain.
Also if I create a subdomain such as sub.copy.com it will show the content from principal.com. Again, without redirect the user to that domain.
I tried configurating the DNS of copy.com to point to the same IP address of principal.com But I don't know how to configure this domain in IIS7 for use the same physical path as principal.com or If I need to do some other task...
I have done this with apache and the vhost files. Pointing multiple domains to the same DocumentRoot and configurating the DNS to use the same IP ADDRESS... But with IIS7 I don't know how to do it...
How Can I achieve what I want?
If you add multiple host headers to the web site (one for each domain), IIS should be able to serve up the same content for both requests.
To do this, click on the site in IIS, in the right hand panel ("Actions"), click on "Bindings..." and there you should be able to enter the different host names.

DNS and Subdomain IIS

I have 2 web apps installed on my IIS, one running as app1.mydomain and other one as app2.mydomain
In the test environment I just copied about two entries pointed to 127.0.0.1
What changes do I have to do in order to put this on production server, I mean on DNS level?
Can I use URL re-write on IIS to avoid changes for DNS?
Thanks
You need to add A or CNAME records mapping both subdomains to the external IP address of your server.
This tells web browsers to go to your server when you go to the subdomain; URL rewriting has nothing to do with this.

Resources