How to configure IIS to host multiple websites? - windows

Suppose there are a.com,b.com,how to host them both with the same IIS?
EDIT
It's not hello.domain.com and goodbye.domain.com,but two totally different domain names

You should look at creating multiple websites and using different host headers. Note if you are developing on Windows XP then you can only host 1 website (without using a tool downloaded from the internet).
Refer to these articles:
http://support.microsoft.com/kb/190008
http://www.visualwin.com/host-header/
Note: This question is better asked at ServerFault.com :)

Define multiple "Web sites" (as much as desired amount of virtual hosts), then for each web site, right click > properties > "web site" tab > "Advanced" button on "IP adress" row and there define your virtual hosts in "Host header value" field

i'm going completely off of memory. but what Oliver means (i believe). is in IIS. you click to create new website. name it whatever you want. in the properties section you will want to click on the tab that will show host names. Probably will also show text for multiple identies. leave IP address as all unassigned. and put in the domain name you want to answer. this can be my.domain.com or just domain.com or domain.local or whatever.
Do that for each website. Also in the properties you will need to select the domain's source files (which point to directories on the server's harddrives).
example for older iss 4 and 5

I solved issue. I just updated my server IP in Domain Name registered site (it will take some time for reflecting depend on your operator).
In IIS expand top menu then in site go to default site
right click on default site go to edit Binding then edit port.
Add any other port than default (8080) save
In IIS expand top menu then right click on site then click on add website.
Give name to website select default app pool pass physical path of application then below in binding select HTTP protocol in IP field set default All Unassigned in port add default port (must be 80) in host name add host name.
restart website and browse

Related

Visual Studio default Blazor server side web application counter button works in IIS browse but not over the internet

I'm using Visual Studio 2019 (as Administrator) and IIS Express with the extra Widows 10 features needed to publish web sites on the internet. I created a new Blazor app with the following choices:
Server Side
.NET 5.0 (because .net3.1 does not have ProtectedBrowserStorage)
Authentication - None
Configure for HTTPS (because my domain name uses Cloudflare servers)
Enable Docker - No
Environmental variables
Project properties - None
Windows AdvancedSystemSettings - Development
I did not add any more components nor did I modify the default code.
I built and ran it in release mode.
The web site displayed the home page on a Chrome browser.
I could navigate to the Counter page.
When I clicked the "Click Me" button the current count incremented as it should.
Then I published it to the default file ("~bin\release\net5.0\publish).
I copied this file (with admin privileges) into inetpub and renamed it "B02".
In IIS I created a new web site called B02 specifying the physical path as C:\inetpub\B02.
New App Pool B02 was created and I accepted it.
I did not add a specific user so Test Connection failed but I think this is OK.
I added two bindings
https port 443 IP Address *
https port 443 IP Address 19.168.0.34 (the reserved address of the computer on the router to which port 443 is forwarded. i.e. I'm using port forwarding on a NetGear router)
I could then click, in IIS, "Browse*:443(https) and the web site was OK. I could navigate to any page and all links worked including the "Click Me" button which incremented the counter.
The problem is that when I enter into the Chrome browser the address
"https://www.bkdaniels.com" the web site appears, I can navigate to any of the three pages, the About button works, the "Brief Survey" button works BUT THE "CLICK ME" BUTTON DOES NOT INCREMENT THE COUNT. (It does change the style of the border of the button).
I have presented this simple problem in the hopes that it will enable me to make user interactions work on a custom web app I have written. Presently they all work in IIS browse but not over the internet.
My domain name "bkdaniels.com" is registered with GoDaddy where I have specified to use name servers at Cloudflare because Cloudflare provides and SSL Certificate that prevents clients seeing a warning about the site being not secure.
7/29/22 A solution has been found.
A couple of trivial changes that cleaned up warnings in the Browser console were as follows:
Installed 6.0 SDK
Added to Program.cs - app.UseWebSockets()
These alone did not solve the problem. the Counter click me button still failed to increment the count.
The action that solved the problem was to go to GoDaddy and change the nameservers from Cloudflare servers to GoDaddy default name servers.
I then had to by pass the security warning since I no longer had the SSL certificate that Cloudflare provided. So I clicked "Run Anyway".
The "click me" button incremented the counter.
I will now work with Cloudflare support to find a way to make it work through their nameservers.
8/15/2022 I have now found that a temporary workaround is to set the Cloudflare Dashboard Cache to Developer Mode. This solves the problem with the counter button and also enables my main web site to work. I am still looking for a proper solution.
8/29/2022 SOLUTION
This solution enabled the click on the default Blazor Server app to work and it also enabled my serious web site to work perfectly.
Cloudflare/ logon/ domain name/ dashboard/ speed/ optimization/ auto minify/ HTML / OFF
.

Why (non existing) subdomain of my add-on domain redirecting to primary domain?

I am using 1and1 cloud with plesk.
I have a http://primary.com and an http://addon.com
Right now if if some one enter any none existing subdomain e.g. blabla.addon.com, the URL in browser address bar stays the same but contents coming from http://primary.com/
I wanted contents to come from http://addon.com
Can anyone please guide me to the right direction?
This happens because by default Plesk will serve it's "Web Server's Default Page" template.
If you want to change this behaviour you need to set a default domain that will be served instead.
The setting you are looking for is located at:
Tools & Settings > IP Addresses > Your IP (click) > Default site > Domain (addon.com)

New website not showing default page in IIS 8.5

I’m having trouble trying to view my default page or other web application on a newly created site (New Test Site) on IIS 8.5 for Windows 8.1. I included a directory that contains an html page (test.html) outside of the ‘inetpub’ folder.
Add website window
Physical Path: C:\royalcenters
Type: http
IP Address: All Unassigned
Port: 80
I already arranged the ‘test.html’ page to the top of the list of ‘Default Document’ tab.
List of default pages
However, when I ran the new website on a web browser, the page doesn’t appear. It only shows an error page.
I’m trying to run the website with my computer as the server, so does anybody have any ideas on how to on how I can run the new website on my machine? Thank you.
first things first goto http://localhost/ and see if it works. It should show the IIS Welcome page with version number. If you get a 503 error check if the default app pool is stopped for some reason. If other errors then need to fix those before proceeding to test your html page.
Try hosting that page under the site "Default Web Sites" that comes pre-built with IIS . It uses the default port 80. So if you want to create your own site you need to use a different port number when you create that new site from IIS manager gui.
The default website typically points to a physical folder : c:\inetpub\wwwroot\
so copy your test.html page to the above folder and test by going to the URL : http://localhost/test.html
if it works then Try to create a new Web Site using directions from here (Step 2) below. You can leave the hostname blank if you only intend to use the URL from your local PC. the url will be http://localhost:port/
http://www.iis.net/learn/manage/creating-websites/scenario-build-a-static-website-on-iis#02
EDIT:
so when you are at this screen when creating a new wesite :http://i.stack.imgur.com/1YwVG.jpg
do this :
Sitename = Site01
Apppool = DefaultAppPool (Make sure its started)
Physical path = C:\inetpub\Site01 -- Need to create and grant full rights to Everyone (for now but need to change later to a specific windows account )
Port : 8090
Hostname = Blank
Click Ok
Copy test.html to C:\inetpub\Site01
Browse to http://localhost:8090/test.html

Customize URL with Heroku and OVH

I push my app I create with Ruby on rails on heroku and I have by default myapp.herokuapp.com
I buy my domain name on OVH I do heroku domains:add www.myapp.co to redirect to myapp.herokuapp.com.
I want to have only www.myapp.co this target and keep this went I am on the app. Could you guide to configure it on OVH.
I read this https://devcenter.heroku.com/articles/custom-domains and do what they say i don't understand check my url synestasia.co
Thank your for your help. really don't understand.
Steps needed to point (redirect) your OVH root domain (eg. yourdomain.com) to your heroku application.
Go to domain section in OVH and select your domain. Then click DNS ZONE
Remove entries (you can omit this step but OVH will tell you the same when you try to add an entry): Domain: www.yourdomain.com with types of: CNAME yourdomain.com, TXT 3|welcome, TXT l|pl (but this may depend on the
language as I'm using PL language).
Add CNAME record with www subdomain and target to your heroku CNAME domain you have from heroku website eg. my-application-fcmnqo274218034.herokudns.com. Confirm clicking next and confirm next step too.
Go to the Redirection tab and click Add a redirection. Leave both fields blank (one with domain address where you need to fill subdomain and Also redirect www.yourdomain.com checkbox unchecked. Click Next.
In the next page you should see What type of target do you want to redirect yourdomain.com to? question. Select to a web address and click Next
Next page says What type of redirection do you want to use to redirect yourdomain.com ?. Select with a visible redirection. and click Next.
In the next window select Permanent (301) redirection and then you will be asked to provide your full address as in the placeholder eg. https://www.yourdomain.com, then click next and validate the redirect rule.
Domain propagation might take a while (up to ~24h but mine was ready in few minutes). To not cache domain pointing to the DNS in your browser (as this might be fooling your with your website not found but it might work for others) you might want to use some tool to check if domain points to new servers (eg. https://dnschecker.org - that's not spam, I have nothing common with them)
Thanks to this user for posting that solution: http://community.ovh.com/t/redirection-vers-app-heroku/6392/16
To serve your domain name from Heroku, you need to tell the DNS service you use where your server is hosted.
Typically, this is done by declaring an A record DNS entry: A records expect a static IP address and so you just fill in your server's IP.
The challenge with Heroku is that it uses dynamic IP addresses, so A records are not an option.
So the other option is to declare a CNAME record: a CNAME points a name to another CNAME or an A record.
Problem is: CNAMEs are NOT supposed to be used for root domains (AKA base domain or apex domain.) They will only work with subdomains.
So you could easily declare www.example.com to point to your Heroku app (on ANY DNS service, including OVH), but not example.com.
To help with this problem, some DNS services came up with their own solutions that basically let you point a root domain to another domain.
The Add a custom root domain section of the Heroku docs mentions a bunch of these providers:
ALIAS at DNSimple
ANAME at DNS Made Easy
ANAME at easyDNS
ALIAS at PointDNS
CNAME at CloudFlare -- a bit of a misnomer
OVH offers no such option (maybe unsurprisingly given most of their business comes from hosting servers.)
Bottom-line: if your domain name is provided by OVH, either use a subdomain (e.g.: www.mysite.com) or change your NS records to use a different DNS service, one that supports CNAME-like functionality at the apex.
I'm no sysadmin. I spent a lot of time on this issue too and hope this helps.
Heroku panel -> Your APP -> Settings -> Domains and certificates -> Add Domain.
Copy DNS Target
Log in OVH
WEB -> DOMAINS -> Your domain
DNS ZONE
Field: www.yourdomain.com | Type : CNAME | Target: yourdomain.com
Click " ... " -> Change Entry -> Delete Target -> Paste Heroku DNS Target + " . (dot)"
Sometimes you have to wait 24 hours.

Routing a url to fetch content from another site

Environment: IIS 7.
I have a default site www.domain.com. Folder C:Inetpub/wwwroot/domain
There is subdomain www.subdomain.domain.com. Folder C:Inetpub/wwwroot/domain/subdomain.
Now, I have set up a new website at an external server, say www.newdomain.com. I cannot host www.newdomain.com on the same IIS server (as mentioned above) due to some constraints.
In this setup, how do I get www.subdomain.domain.com/blog to show all the content available on www.newdomain.com while preserving the URL as www.subdomain.domain.com/blog
How could this be achieved in IIS 7?
You would have to put the entire www.subdomain.domain.com on the other server. You can't put just the /blog path somewhere else.
How would any client know to go to that other server for /blog if the DNS for the subdomain points to the first server?
Alternatively, you could create blog.subdomain.domain.com for the blog server.
Possible approaches:
Host the new website as blog.domain.com with the actual content hosted on a different server (not the same IIS server as domain.com)
Set-up a ProxyPass on subdomain.domain.com/blog to the new website. I know how do to this on Apache (via mod_proxy and ProxyPass), but not sure how to do this with IIS. Probably ARR can help you.
I was finally able to do this by reverse proxy rewrite rule. For those who have similar trouble here is the solution:
Go to the site node hosting www.subdomain.domain.com and click rewrite rule. If ARR is not installed the IIS Manager will ask you to install it. After installing ARR close and reopen the IIS Manager.
Open the rewrite rule window. There will be a dialog asking to allow reverse proxy to servers outside your server farm, accept that. In the Inbound rule enter www.newdomain.com. In the from input of the Outbound rule enter www.newdomain.com and in the to input enter www.subdomain.domain.com. click apply changes.
This will route the entire www.subdomain.domain.com to newdomain.com. What you need is to route only the /blog link.
To do this go to rewrite rules and select the rewrite rule you just created. Click edit and in the match section in url input change (.asterix) to ^blog(.asterix). This will apply the rule to route only the /blog.
That all. test your routing in the browser, if everythings fine this should work.

Resources