IIS 7 works without much hassle with PHP applications and supports URL rewriting since about a year. There's now a real push by Microsoft to spread IIS 7 + fastcgi + PHP + urlrewrite with their new Webplatform installer.

IIS 7 is likely the most prevalent webserver on "wannabe" developer desktops (XP Pro, Vista Ultimate, Windows 7 XYZ) and, in my experience, much easier to configure (for newbies) than Apache.

We've been shipping Drupal with an Apache configuration file for a long time. Why not ship Drupal with a default web.config for IIS 7 to make Drupal even more accessible for new developers?

A side benefit would be to allow established .NET shops an easy entry point to use Drupal on their existing infrastructure.

A good web.config would

- make clean URLs work (big deal)
- make file protection work (big deal)
- make caching settings work
- make index.php the default document
- make index.php the 404 error handler

Preemptive:
But should we also ship with lighttpd configuration files? nginx? [favorite du jour]?

Maybe, but I do not think supporting IIS 7 means we need to cater to marginal servers as well.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gerhard Killesreiter’s picture

Microsoft pushing for something should be enough reason to won't fix this.

alexanderpas’s picture

+1, for several reasons, as it makes drupal more widdespread, and opens up a whole new slew of drupal sites, which are currenly having a vendor lock-in, and makes moving hosts a lot easier when they go over to a LAMP host finally, as we can offer them a robust upgrade path.

about your Preemptive: we should, if they manage to obtain a marketshare of 10% (when will drupal be running on google servers?)

Vendor Product Web Sites Hosted Percent
Apache Apache 96,531,033 52.05%
Microsoft IIS 61,023,474 32.90%
Google GWS 9,864,303 5.32%
nginx nginx 3,462,551 1.87%
lighttpd lighttpd 2,989,416 1.61%
Oversee Oversee 1,847,039 1.00%
Others - 9,756,650 5.26%
Total - 185,474,466 100.00%

- http://en.wikipedia.org/wiki/Web_server
- http://survey.netcraft.com/Reports/200901/

sepeck’s picture

I would be in favor of this. This gives a better out of the box Drupal experience on more web servers then just Apache.

terramedia’s picture

After the massive amount of issues around clean URL's and the private file system, I have to agree, there seems to be no clear cut, simple way to make these things work on an IIS shared hosting platform, it would be great to have an easy way to do all of this, and for Drupal to just work with IIS7.

dirksonii’s picture

Windows is running 30% of all websites? ... I'm depressed now. I'm very, very depressed.

bsherwood’s picture

I think this is a good idea. Granted IIS is not open source, but we are trying to make Drupal more accessible not take a radical hard line FOSS stance.

Sure I would love to see MS have less market share in serving web pages (and IE take a nosedive) but we should remain focused on spreading Drupal and making it the CMS of choice. Let's not cut off our nose to spite our face.

Aren Cambre’s picture

+1

Heine’s picture

Status: Active » Needs review
FileSize
2.17 KB

I recently tried the Web platform installer (aka WebPI), and it's one of the easiest ways to get Drupal running on Vista / Seven for a Windows development machine. (ANd yes, WebPI also works on Home Premium editions).

Here's a simple web.config, adapted from Acquia Drupal.

Bèr Kessels’s picture

Another reasoning is that IIS, being very easy to install, will be installed a lot by people who are less informed when it comes to security. In other words: someone who manages to get a custom lighty running, has a bigger chance of being security aware, then a user clicking on three [next »] buttons.

We -as Drupal- should avoid opening vulnarabilities on those people's machines. It will backfire: if word gets out that 'installing Drupal on IIS opens security holes', even if it technically is the users fault, we get the blame.
If avoiding that, is as simple as adding a simple file, I see only reasons to include that file.

Downside is that is will need to be maintained, to avoid giving people a false sense of security.

Aren Cambre’s picture

Another reasoning is that IIS, being very easy to install, will be installed a lot by people who are less informed when it comes to security.

I don't agree with that at all. On Ubuntu just type sudo tasksel install lamp-server and you're done. And IIS 7 is pretty rock solid secure from the beginning.

Obscurity doesn't mean security, and ease of use doesn't mean insecure.

moshe weitzman’s picture

Seems like an obvious win. Just needs a reviewer to move it to rtbc.

webchick’s picture

I think I'd be fine with this, too. The only real reason not to do it is the "slippery slope" argument, but when we're talking about this type of critical security (not to mention usability) enhancement, I'm not sure that holds much weight.

sepeck’s picture

IIS 7 out of the box is pretty darn secure. I have successfully unsecured Apache based setups faster then IIS based setups because of familiarity based causes.

Damien Tournoud’s picture

Status: Needs review » Reviewed & tested by the community

I'm running with that for a few weeks now. Works flawlessly out of the box.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, let's do this then.

Committed to HEAD.

Gábor Hojtsy’s picture

Version: 7.x-dev » 6.x-dev
Status: Fixed » Patch (to be ported)

Same works for Drupal 6 (given this was adapted from Acquia Drupal)?

sun’s picture

Version: 6.x-dev » 7.x-dev
Status: Patch (to be ported) » Needs work
--- /dev/null
+++ web.config

Shouldn't we hide this file from prying eyes?

Powered by Dreditor.

Damien Tournoud’s picture

@sun: there is no real need to. We don't hide CHANGELOG.txt, I don't see why we should hide web.config. On Windows systems, this file is automatically hidden by IIS.

c960657’s picture

We need automated tests for this: #771430: Add test bot running IIS + Windows

c960657’s picture

Status: Needs work » Needs review
FileSize
2.66 KB

The “Protect files and directories from prying eyes” rule differs from that in .htaccess. It omits .make files and adds .svn-base files. I assume this wasn't intentional?

Also, the file does not implement the protection added in #581706: Protect .git, .hg and .bzr directories in .htaccess. Is that possible simple by extending the pattern in the <match url=""> rule?

This patch has not been tested.

sun’s picture

+++ web.config	15 Apr 2010 20:50:29 -0000
@@ -1,43 +1,43 @@
-          <match url="\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$" />
+          <match url="\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$" />

Am I blind or is .config not added here?

Also, what about .config in .htaccess?

Powered by Dreditor.

Aren Cambre’s picture

This .config is irrelevant except on IIS, and on IIS it is unbrowseable unless the IIS administrator changed that parameter. That would be a really weird change.

sun’s picture

Status: Needs review » Reviewed & tested by the community

This patch has not been tested.

Let IIS users test? I can't see what could break with this patch.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Version: 7.x-dev » 6.x-dev
Status: Closed (fixed) » Patch (to be ported)

Same works for Drupal 6 (given this was adapted from Acquia Drupal)?

Heine’s picture

Status: Patch (to be ported) » Needs review
FileSize
2.17 KB

This works; I'm running with such a web.config on my dev server for several months.

I've specifically tested again:

block sql / module / inc
block favicon.ico with a cheap IIS 404 but not misc/favicon.ico

Here's a reroll of the latest Drupal 7 web.config that should still work on D6 (so, _with_ a query string).

Heine’s picture

Here's the latest web.config by Mark Brown and the MS webteam converted to a patch. There are some questions open regarding the post-install files (required for WebPI?) and the allowed files list.

Damien Tournoud’s picture

Do we need to bump that to D7 again?

Gábor Hojtsy’s picture

Version: 6.x-dev » 7.x-dev

Yes, looks like.

Heine’s picture

Here's a patch for D7. Only change compared to the D6 one is to deal with drupal_environment_initialize.

Heine’s picture

Ruslan got back to me and no, postinst serves no purpose. Has been removed in attached patch. Also wrapped a few non-config comments at 80 chars.

attiks’s picture

CVS version patched and installed with minimal version on Windows2008 without any problems

Heine’s picture

The rewrite section needs comments to help with installs like those in #980128: web.config error when upgrading from D6 to D7 on IIS missing urlrewrite and/or needs requirements docs & faqs.

Heine’s picture

Version: 7.x-dev » 8.x-dev
Dries’s picture

Version: 8.x-dev » 7.x-dev

I'm not a IIS user but this looks reasonable for inclusion in 8.x. Committed. Requires more review before this can be committed to 7.x.

webchick’s picture

Issue tags: +Needs backport to D7

Tagging, so I don't lose track of this.

potss’s picture

i used 2 last patches on drupal 7 web.config

i have not clean url if patch this section

-          <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
+          <!-- Pass all requests not referring directly to files in the filesystem to
+           index.php. Clean URLs are handled in drupal_environment_initialize(). -->
+          <action type="Rewrite" url="index.php" />

Windows web server 2008 R2 iis

David_Rothstein’s picture

Marked #1537898: Fix for web.config for windows based installs as duplicate, since it proposes the same change as this part of the patch:

     <defaultDocument>
-      <!-- Set the default document -->
+     <!-- Set the default document -->
       <files>
-        <remove value="index.php" />
+         <clear />
         <add value="index.php" />
       </files>
     </defaultDocument>
jsmith2002’s picture

I'm running with that for a few weeks now. Works flawlessly out of the box.

manarth’s picture

It would be helpful if the web.config file contained a brief comment to explain what the file is for.

I found out through the file's git history, and I suppose a quick internet search would answer the question, but a brief comment would be harmless and useful.

Patch attached (rolled against 8.x-dev)

hass’s picture

mgifford’s picture

Issue tags: -Needs backport to D7
mgifford’s picture

  • webchick committed e11daeb on 8.3.x
    #567072 by Heine: Ship Drupal 7 with a configuration file for IIS 7.
    
    
  • Dries committed 26392c8 on 8.3.x
    - Patch #567072 by c960657: tweak the IIS 7 configuration file.
    
    
  • Dries committed 8607660 on 8.3.x
    - Patch #567072 by Heine: improvements to the IIS 7 configuration file.
    
    

  • webchick committed e11daeb on 8.3.x
    #567072 by Heine: Ship Drupal 7 with a configuration file for IIS 7.
    
    
  • Dries committed 26392c8 on 8.3.x
    - Patch #567072 by c960657: tweak the IIS 7 configuration file.
    
    
  • Dries committed 8607660 on 8.3.x
    - Patch #567072 by Heine: improvements to the IIS 7 configuration file.
    
    

  • webchick committed e11daeb on 8.4.x
    #567072 by Heine: Ship Drupal 7 with a configuration file for IIS 7.
    
    
  • Dries committed 26392c8 on 8.4.x
    - Patch #567072 by c960657: tweak the IIS 7 configuration file.
    
    
  • Dries committed 8607660 on 8.4.x
    - Patch #567072 by Heine: improvements to the IIS 7 configuration file.
    
    

  • webchick committed e11daeb on 8.4.x
    #567072 by Heine: Ship Drupal 7 with a configuration file for IIS 7.
    
    
  • Dries committed 26392c8 on 8.4.x
    - Patch #567072 by c960657: tweak the IIS 7 configuration file.
    
    
  • Dries committed 8607660 on 8.4.x
    - Patch #567072 by Heine: improvements to the IIS 7 configuration file.
    
    

  • webchick committed e11daeb on 9.1.x
    #567072 by Heine: Ship Drupal 7 with a configuration file for IIS 7.
    
    
  • Dries committed 26392c8 on 9.1.x
    - Patch #567072 by c960657: tweak the IIS 7 configuration file.
    
    
  • Dries committed 8607660 on 9.1.x
    - Patch #567072 by Heine: improvements to the IIS 7 configuration file.