简体   繁体   中英

IIS Site binding and subdomain

I use IIS 8.5 on Windows 2012 server. I set my website 'www.site.com' on physical root path 'c:\\inetpub\\site'. All is OK.

Now I would like set a subdmain 'sub.site.com', with same root path (to use same includes en relative paths) and different default page.

So I tried to create a new site with hostname 'sub.site.com' => It works but the default page is same as 'www.site.com'.

So I decided to change default document for site 'sub.site.com', and added 'sub.aspx' => It works, but it changes the default document of 'www.site.com'! (I know on IIS 6 that configuration worked, but not here in IIS 8.5).

I read about adding a web app, but how to redirect hostname 'sub.site.com' to this new app ?

What about virtual directory? Can I use it? How?

Thanks in advance for help.

Regards.

create your first site 'www.site.com' and point it to c:\\inetpub\\site then create a new website 'sub.site.com' and point it to a new folder c:\\inetpub\\site2

then edit the bindings for each site and set the host name to the appropriate subsite. Now each site will work independent of the other. (note host name blank and port 80 will make it the default site when there is no matching host name elsewhere).

To share include files, create a folder in site1 and put the files you want to share between the sites. Then on the second site2, create a virtual folder in IIS with the same name as the physical folder in site1. Now from each site, you can use the same includes path and share the same files.

You will also need to set the permissions to the shared folder under the first site1 to allow the second site app pool user to use the files. (NTFS permissions allow "IIS AppPool\\APP_POOL_NAME" modify access).

If you want to use sub folders as sites, then one of the sites (either one) create a folder then in IIS (expand the tree view under the site on the left) right click the folder and choose 'convert to application'. Now it is a sub site. Remember subsites will inherit the root site web.config settings by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM