0

Imagine the folllowing directory structure:

c:\websites\users\dave\
c:\websites\users\dave\www.mysite1.com
c:\websites\users\dave\www.mysite2.com
c:\websites\users\alan\
c:\websites\users\alan\www.oursite1.co.uk
c:\websites\users\alan\www.oursite2.co.uk

As far as I know, in order to make this work I'd need to set up four separate websites in IIS. What I'd really like to do is for dave and alan to have FTP access into their c:\websites\users\dave\ and c:\websites\users\alan\ directories and then be able to create brand new websites by just creating a new www.mysite3.com directory and pointing the domain at the right IP address, without us needing to add a new website in IIS.

Is this even possible?

5 Answers 5

0

You can't do it without creating an additional site. Without either a different IP binding or host header, IIS has no way of knowing what content to serve.

You could, however, set up some sort of script at the root of the site to redirect to the proper content by anaylzing the incoming request's host header. For example, you'd point all the sites to the same IP, then redirect.aspx/php/py/whatever looks at the host header, and redirects to correct content.

1

without us needing to add a new website in IIS.

Impossible. IIS needs to know how to route requests. Rights need to be set up. But mostly - you need IIS configuration.

3
  • Disappointing. You can do this in Apache can't you?
    – user57850
    Oct 21, 2010 at 17:53
  • what rights? That's irrelevant because dave and alan will both have their own FTP accounts. And IIS could have some means of routing based on directory names, or some web.config based solution even? Something that allows the main server admin to avoid getting involved.
    – user57850
    Oct 21, 2010 at 18:04
  • Then you do not like security at all. I secure every website with their own running user, iloated to read only on that directory path.
    – TomTom
    Oct 21, 2010 at 21:24
1

As others have said and I'll repeat, you can't do it without creating an additional site.

However, you can fake it, especially if they keep to the naming convention you list above. What you do is create a scheduled task that checks the sub-levels of those user directories. When it finds a dirname that looks right, it then runs some commands that create the site for you. Create the script in PowerShell which gives you vastly better string handling semantics and error checking than simple batch-files. Run it every 15 minutes or something.

Some key commands:

Adding a site:

appcmd add site /name:"www.mysite1.com" /bindings:http://www.mysite1.com:80/ /physicalPath:"c:\websites\users\dave\www.mysite1.com"

Removing a site:

appcmd delete site "www.mysite1.com"

Seeing if a site already exists:

appcmd list site "www.mysite1.com"

The 'appcmd' utiltiy is located in C:\Windows\System32\Inetsrv\. The site created with the above command will use a host-header to determine which site the server will serve.

0

This is on the right track. setup your sites within that directory path and then create IIS sites for each directory which will serve the sites document root.

Create ftp, setup each ftp site with a corresponding document root to match the site in which they should have access. Protect the other document roots ftp by modifying the NTFS permissions, set the ACLs using Allow or Deny. Set deny rules for the users whom should not be able to read and or write to those directions.

1
  • I don't think this addresses the question though: how would each newly created www.mysite1.com directory get served up by IIS?
    – user57850
    Oct 21, 2010 at 17:52
0

You could have one IIS site, with multiple host name headers. Then have a default document of, say, index.aspx. The code within could then detect the URL that you've specified and go to, for example, ./dave/www.mysite1.com/index.aspx.

You must log in to answer this question.