How to install WordPress on IIS

Tutorials, Web Development

Wordpress hosting is dominated by linux-based platforms using mostly Apache on Nginx setups. But if you need to run a website from a Windows machine or VPS, IIS is probably the right way to go. Although there are some tweaks that have to be made, you can easily get your Wordpress instance running in less than 30 minutes.

Prerequisites:

  1. Microsoft IIS 7 or higher
  2. PHP 7 (recommended version)
  3. MySQL-compatible database

Create a new Site on IIS

Start by creating a new directory for your WordPress website in the default location for IIS websites (usually C:\inetpub\wwwroot\). Download the latest WordPress package from the official website and extract the contents into that directory.

How to install WordPress on IIS

We also need to grant read/write permissions for IIS to the wp-content directory so that WordPress will be able to save and modify files (e.g. when installing plugins or uploading files). Right click on the website directory and open up Properties. Head to Security and click Edit. Then, set the Modify permission for IIS_IUSRS (IIS user group) and IUSR (default IIS user).

Next, open the IIS Manager and create a new website in your server instance. You can do that by right-clicking Sites in the left pane and choosing Add new website.

wordpress on iis

Enter your desired website name (this is just for identification within IIS) and point the physical path to the directory we’ve just created. Next, enter the host name your website will be available from. This can be the domain pointing to your IIS machine or a virtual host you’ve created for local development in the system hosts file. Confirm by clicking OK.

install wordpress on iis

Your WordPress instance is already running, but we need to assign the IUSR user to it so our site will have the access rights we’ve just specified. In the left pane, select your newly created website and open Authentication on the right. Edit Anonymous Authentication and set IUSR to be the specific user.

install wordpress iis

Fix access permission for PHP uploads

At this point our website should be up and ready to run but we need to ensure that IIS has enough access rights to handle PHP file uploads. Otherwise, requests for files uploaded through WordPress will result in an error 500.

The reason for this is that PHP doesn’t set access rights for IIS when moving an uploaded file to the website directory (e.g. /wp-content/uploads). In order to fix this we have to grant Modify access rights for IIS_IUSRS to PHP’s temporary directory (usually C:\Windows\Temp but you can check if your php.ini configuration says otherwise).

Open Properties for C:\Windows\Temp, go to Security and click Advanced. First, click Enable inheritance so access rights can be passed down to files and subdirectories.

How to install WordPress IIS

Next, select IIS_IUSRS on the user list (or add it if not present) and click Edit. Set the Modify permission to IIS_IUSRS (IIS user group) and set it to affect only child objects.

wordpress iis

Install WordPress on IIS

You can now go to the domain you’ve specified in IIS and check if the website’s running. Open http://yourwebsitedomain/readme.html for instructions on how to install WordPress on IIS.

After installation there are  couple of things you might want to configure in order to make the most of your WordPress instance.

Enable permalinks

In order to use the user- and SEO-friendly “Pretty permalinks” feature in WordPress, we need to enable URL rewriting. For this to work you need to have the URL Rewrite module for IIS installed.

Next, we need to create a web.config file in the root directory of our website. Add the following rewrite rule to the webserver configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>		
      <rules>
		  <rule name="Wordpress" patternSyntax="Wildcard">
			  <match url="*"/>
			  <conditions logicalGrouping="MatchAll">
				  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
				  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
			  </conditions>
			  <action type="Rewrite" url="index.php"/>
		  </rule>
		</rules>
    </rewrite>
  </system.webServer>
</configuration>

Fix static file serving

By default, IIS is configured to serve only a handful of static files properly (images, plain text files). If you’re planning to use web fonts, SVGs, videos or PDFs, you should declare them in your web.config file like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
	  <staticContent>

		<!-- Proper svg serving. Required for svg webfonts on iPad -->
		<remove fileExtension=".svg" />
		<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
		<remove fileExtension=".svgz" />
		<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />

		<!-- HTML4 Web font mime types -->
		<!-- Remove default IIS mime type for .eot which is application/octet-stream -->
		<remove fileExtension=".eot" />
		<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
		<remove fileExtension=".otf" />
		<mimeMap fileExtension=".otf" mimeType="font/otf" />
		<remove fileExtension=".ttf" />
		<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
		<remove fileExtension=".woff" />
		<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
		<remove fileExtension=".woff2" />
		<mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />
		<remove fileExtension=".crx" />
		<mimeMap fileExtension=".crx" mimeType="application/x-chrome-extension" />
		<remove fileExtension=".xpi" />
		<mimeMap fileExtension=".xpi" mimeType="application/x-xpinstall" />
		<remove fileExtension=".safariextz" />
		<mimeMap fileExtension=".safariextz" mimeType="application/octet-stream" />
		
		<!-- HTML5 Audio/Video mime types-->
		<remove fileExtension=".mp3" />
		<mimeMap fileExtension=".mp3" mimeType="audio/mpeg" />
		<remove fileExtension=".mp4" />
		<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
		<remove fileExtension=".ogg" />
		<mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
		<remove fileExtension=".ogv" />
		<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
		<remove fileExtension=".webm" />
		<mimeMap fileExtension=".webm" mimeType="video/webm" />
		
		<!-- Other types -->
		<remove fileExtension=".pdf" />
		<mimeMap fileExtension=".pdf" mimeType="application/octet-stream" />
		
	  </staticContent>
	  
	  <!-- other settings, e.g. rewrite rules -->
	  
  </system.webServer>
</configuration>

Enable Caching

Caching can significantly speed up your WordPress website by serving pre-generated content without calling PHP scripts and database queries over and over again. This is easily achieved with WinCache and WordPress plugins.

Unfortunately, installing WinCache extension from the IIS homepage may break WordPress plugin updates. This is easily fixed by installing the latest repo version manually.

Download the latest development version from the WinCache SourceForge and extract it to your PHP extension directory (e.g. C:\Program Files (x86)\PHP\v7.0\ext).

Next, you only need to install a WordPress plugin that will handle the caching. Double-check the plugin platform support! As of now, the popular WP Total Cache won’t work with IIS. We recommend using WP Super Cache instead, as it supports IIS and WinCache.

Check out other iOS development tutorials on our blog: JetLobster ruby local APNs testing tool.

Arthur Krupa COO, Co-founder

Designer by profession, and an engineer at heart. At Zaven he supervises everything connected with visual communication and user experience. On quiet evenings, he enjoys watching documentaries, playing the piano or reading a book. Arthur has a passion for trekking and climbing, that’s why he catches himself daydreaming about mountains far far away...

Comments are closed.

Popular posts

From Hype to Hard Hats: Practical Use Cases for AI chatbots in Construction and Proptech.

From Hype to Hard Hats: Practical Use Cases for AI chatbots in Construction and Proptech.

Remember the multimedia craze in the early 2000s? It was everywhere, but did it truly revolutionize our lives? Probably not. Today, it feels like every piece of software is labeled "AI-powered." It's easy to dismiss AI chatbots in construction as just another tech fad.

Read more
Fears surrounding external support. How to address concerns about outsourcing software development?

Fears surrounding external support. How to address concerns about outsourcing software development?

Whether you’ve had bad experiences in the past or no experience at all, there will always be fears underlying your decision to outsource software development.

Read more
What do you actually seek from external support? Identify what’s preventing you from completing a project on time and within budget

What do you actually seek from external support? Identify what’s preventing you from completing a project on time and within budget

Let’s make it clear: if the capabilities are there, a project is best delivered internally. Sometimes, however, we are missing certain capabilities that are required to deliver said project in a realistic timeline. These may be related to skills (e.g. technical expertise, domain experience), budget (hiring locally is too expensive) or just capacity (not enough manpower). What are good reasons for outsourcing software development?

Read more
Mobile Apps

Get your mobile app in 3 easy steps!

1

Spec out

with the help of our
business analyst

2

Develop

design, implement
and test, repeat!

3

Publish

get your app out
to the stores


back to top