Contents

Install WordPress on IIS

08 Aug 2017 0 4  1
How to Install WordPress IIS
How to Install WordPress IIS

Introduction

WordPress is a blog publishing application and content management system.

According to ‘wordpress.org’,WordPress is ‘a state-of-the-art semantic personal publishing platform with a focus on aesthetics, Web standards, and usability’.

In this tutorial we will teach you how to install and configure WordPress for use with FastCGI on Internet Information Services 7 (IIS 7) and above.

This tutorial assumes that you have completed the setup and configuration of the FastCGI extension and PHP libraries.

The following article provides guidance for installing WordPress manually. The instructions have been tested and found to work in the following configurations:

Windows Server® 2008 operating system
IIS 7
PHP 5.2.9
MySQL 5.1.34
WordPress 2.8.5

Prerequisites

In the base default configuration file provided by PHP, edit out the lines below in your ‘Php.ini’ configuration.

Define extension\_dir as c:\php\ext (for example, the location of your php extensions directory).

Uncomment ‘extension=php\_mysql.dll’ in the extensions list to enable MySQL support.

Download and Unpack the Application

For this first step, you will need to download the latest stable version of WordPress. In this article we will be using WordPress version 2.8.5 to uncompress the WordPress files and then copy them over to ‘C:\Inetpub\wwwroot\wordpress’ or some other directory of your choosing.

You are not a required to modify permissions on the WordPress Web directory as the default permissions will suffice.

Set Up the Database

Before starting the installation process for WordPress, you will need to create a database on the server, make a new user, and grant the user ‘db ownership’ permission for the database.

This article will use the information shown below:

Database name: wordpress
 Database user: wordpress
 Account password: wordpress

Modify the Configuration File

Modify the WordPress configuration file to connect to the database.

  1. From Windows® Explorer, navigate to the installation directory ‘C:\inetpub\wwwroot\wordpress’ and rename the file ‘wp-config-sample.php’ to ‘wp-config.php’.
  2. Modify ‘wp-config.php’; change the ‘DB_NAME’, ‘DB_USER’, ‘DB_PASSWORD’, and ‘DB_HOST’ values as follows.
<?php
// ** MySQL settings ** //
define('DB_NAME', 'wordpress'); // The name of the database
define('DB_USER', 'wordpress'); // Your MySQL username
define('DB_PASSWORD', 'wordpress'); // ...and password
define('DB_HOST', '192.168.0.4'); // Change this to the IP address of your database
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
 
// You can have multiple installations in one database if you give each a unique prefix
$table_prefix = 'wp_'; // Use only numbers, letters, and underscores.
 
// Change this to localize WordPress. A corresponding MO file for the
// chosen language must be installed to wp-content/languages.
// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
// to enable German language support.
define ('WPLANG', '');
 
/* That is all, stop editing. */
 
define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
?>

Setup and Configure the Application

  1. From Windows® Internet Explorer®, go to ‘http://localhost/wordpress/wp-admin/install.php’
  2. Type in the name of the blog and your email address. Afterwards, click ‘Install WordPress’.
  3. Remember the temporary password assigned for the administrator account.
  4. Start editing your blog from ‘http://localhost/wordpress/wp-login.php’.
  5. Log onto the blog, then the welcome page should appear.

Enable ‘Pretty Permalinks’

Normally, WordPress users need to use ‘almost pretty’ URLs (for example, http://contoso.com/index.php/yyyy/mm/dd/post-name/).

Using the URL Rewrite module, you can make ‘Pretty Permalinks’  (for example, http://example.com/year/month/day/post-name/) for WordPress blogs hosted on IIS.

The next couple of steps will assume that WordPress is installed in a Web site root directory. If you have your WordPress installed in a sub directory, the rewrite rules have to be included in the ‘Web.config’ file located inside the same sub directory as the WordPress files.

  1. Install URL Rewrite Go Live release.
  2. Log on to WordPress as an administrator.
  3. Click the ‘Settings’ button.
  4. Click the ‘Permalinks’ tab for the ‘Customize Permalink Structure’ page.

Create Rewrite Rule

  1. Open your ‘Web.config’ file which is located in the same place as the WordPress files. If you do not have a ‘Web.config’ file in the WordPress directory, you will have to make it before this.
  2. copy and paste the following XML section into the system.
webServer element:

<rewrite>
 <rules>
 <rule name="Main Rule" stopProcessing="true">
 <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>

The rule above will match any requested URL; if the URL does not correspond to a file or a folder on a file system then the rule will rewrite the URL to ‘Index.php’ and will determine which content will be served mostly based on the ‘REQUEST_URI’ server variable which will contain the original URL before being modified by the rule.

Test the Rewrite Rule

Once the rewrite rule has been saved to the ‘Web.config’ file, you can open a web browser before clicking on any of the permalinks in your WordPress blog. You should see the right content returned by the Web server for every permalink.

Conclusion

Congratulations, you should now have a blog welcome page and everything should be working.

1 Comments
Add a comment

One Reply to “Install WordPress on IIS”

Leave a Reply

Your email address will not be published. Required fields are marked *