{"id":5113,"date":"2018-09-25T12:49:28","date_gmt":"2018-09-25T12:49:28","guid":{"rendered":"http:\/\/www.webputzer.com\/?page_id=5113"},"modified":"2018-09-25T12:56:17","modified_gmt":"2018-09-25T12:56:17","slug":"a-page","status":"publish","type":"page","link":"http:\/\/www.webputzer.com\/?page_id=5113","title":{"rendered":"How to install WordPress on IIS"},"content":{"rendered":"<p class=\"lead\">WordPress hosting is dominated by linux-based platform 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.<\/p>\n<p>Prerequisites:<\/p>\n<ol>\n<li>Microsoft IIS 7 or higher<\/li>\n<li>PHP 7 (recommended version)<\/li>\n<li>MySQL-compatible database<\/li>\n<\/ol>\n<h2>Create a new Site on IIS<\/h2>\n<p>Start by creating a&nbsp;<strong>new directory for your WordPress website<\/strong>&nbsp;in the default location for IIS websites (usually&nbsp;<em>C:\\inetpub\\wwwroot\\<\/em>). Download the latest WordPress package from the&nbsp;<a href=\"https:\/\/wordpress.org\/download\/\" target=\"_blank\" rel=\"nofollow noopener\">official website<\/a>&nbsp;and extract the contents into that directory.<\/p>\n<p>We also need to&nbsp;<strong>grant read\/write permissions for IIS to the&nbsp;<em>wp-content<\/em>&nbsp;directory<\/strong>&nbsp;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&nbsp;<em>Properties<\/em>. Head to&nbsp;<em>Security<\/em>&nbsp;and click&nbsp;<em>Edit<\/em>. Then, set the&nbsp;<em>Modify<\/em>&nbsp;permission for IIS_IUSRS (IIS user group) and IUSR (default IIS user).<img decoding=\"async\" class=\"aligncenter wp-image-621\" src=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_authentication_directory-730x888.png\" sizes=\"(max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_authentication_directory-730x888.png 730w, https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_authentication_directory.png 944w\" alt=\"How to install WordPress on IIS\"><\/p>\n<p>Next, open the&nbsp;<strong>IIS Manager<\/strong>&nbsp;and create a new website in your server instance. You can do that by right-clicking&nbsp;<em>Sites<\/em>&nbsp;in the left pane and choosing&nbsp;<em>Add new website<\/em>.<\/p>\n<p><a href=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_new_site.png\"><img decoding=\"async\" class=\"aligncenter wp-image-622\" src=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_new_site-730x473.png\" sizes=\"(max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_new_site-730x473.png 730w, https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_new_site.png 1072w\" alt=\"INSTALL WORDPRESS ON IIS\"><\/a><\/p>\n<p>Enter your desired website name (this is just for identification within IIS) and point the physical path to the directory we\u2019ve 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\u2019ve created for local development in the system hosts file<em>.<\/em>&nbsp;Confirm by clicking OK.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-623\" src=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_new_site_modal.png\" alt=\"CREATE A NEW SITE ON IIS\"><\/p>\n<p>&nbsp;<\/p>\n<p>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\u2019ve just specified. In the left pane, select your newly created website and open&nbsp;<em>Authentication<\/em>&nbsp;on the right. Edit&nbsp;<em>Anonymous Authentication<\/em>&nbsp;and set IUSR to be the specific user.<\/p>\n<p><a href=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_authentication.png\"><img decoding=\"async\" class=\"aligncenter wp-image-624\" src=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_authentication-730x477.png\" sizes=\"(max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_authentication-730x477.png 730w, https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_authentication.png 1072w\" alt=\"iis_authentication\"><\/a><\/p>\n<h2>Fix access permission for PHP&nbsp;uploads<\/h2>\n<p>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.<\/p>\n<p>The reason for this is that PHP doesn\u2019t set access rights for IIS when moving an uploaded file to the website directory (e.g.&nbsp;<em>\/wp-content\/uploads<\/em>). In order to fix this we have to grant&nbsp;<em>Modify<\/em>access rights for IIS_IUSRS to PHP\u2019s temporary directory (usually&nbsp;<em>C:\\Windows\\Temp<\/em>&nbsp;but you can check if your php.ini configuration says otherwise).<\/p>\n<p>Open&nbsp;<em>Properties<\/em>&nbsp;for&nbsp;<em>C:\\Windows\\Temp<\/em>, go to&nbsp;<em>Security<\/em>&nbsp;and click&nbsp;<em>Advanced<\/em>. First, click&nbsp;<em>Enable inheritance&nbsp;<\/em>so access rights can be passed down to files and subdirectories.<\/p>\n<p><a href=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp_inheritance.png\"><img decoding=\"async\" class=\"aligncenter wp-image-625\" src=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp_inheritance-730x492.png\" sizes=\"(max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp_inheritance-730x492.png 730w, https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp_inheritance.png 780w\" alt=\"How to install WordPress on IIS\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Next, select IIS_IUSRS on the user list (or add it if not present) and click&nbsp;<em>Edit<\/em>. Set the&nbsp;<em>Modify<\/em>permission to IIS_IUSRS (IIS user group) and set it to affect only child objects.<\/p>\n<p><a href=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp.png\"><img decoding=\"async\" class=\"aligncenter wp-image-634\" src=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp-730x471.png\" sizes=\"(max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp-730x471.png 730w, https:\/\/blog.zaven.co\/wp-content\/uploads\/2016\/10\/iis_php_temp.png 930w\" alt=\"INSTALL WORDPRESS ON IIS\"><\/a><\/p>\n<h2>Install WordPress on IIS<\/h2>\n<p>You can now go to the domain you\u2019ve specified in IIS and check if the website\u2019s running. Open&nbsp;<a href=\"http:\/\/yourwebsitedomain\/readme.html\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/yourwebsitedomain\/readme.html<\/a>&nbsp;for instructions on how to install WordPress on IIS.<\/p>\n<p>After installation there are&nbsp; couple of things you might want to configure in order to make the most of your WordPress instance.<\/p>\n<h2>Enable permalinks<\/h2>\n<p>In order to use the user- and SEO-friendly \u201cPretty permalinks\u201d feature in WordPress, we need to enable URL rewriting. For this to work you need to have the&nbsp;<a href=\"http:\/\/www.iis.net\/downloads\/microsoft\/url-rewrite\" target=\"_blank\" rel=\"nofollow noopener\">URL Rewrite<\/a>&nbsp;module for IIS installed.<\/p>\n<p>Next, we need to create a&nbsp;<em>web.config<\/em>&nbsp;file in the root directory of our website. Add the following rewrite rule to the webserver configuration:<\/p>\n<pre><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<configuration>\r\n  <system.webServer>\r\n    <rewrite>\r\n      <rules>\r\n\t\t  <rule name=\"Wordpress\" patternSyntax=\"Wildcard\">\r\n\t\t\t  <match url=\"*\"\/>\r\n\t\t\t  <conditions logicalGrouping=\"MatchAll\">\r\n\t\t\t\t  <add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\"\/>\r\n\t\t\t\t  <add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\"\/>\r\n\t\t\t  <\/conditions>\r\n\t\t\t  <action type=\"Rewrite\" url=\"index.php\"\/>\r\n\t\t  <\/rule>\r\n\t\t<\/rules>\r\n    <\/rewrite>\r\n  <\/system.webServer>\r\n<\/configuration><\/pre>\n<h2>Fix static file serving<\/h2>\n<p>By default, IIS is configured to serve only a handful of static files properly (images, plain text files). If you\u2019re planning to use web fonts, SVGs, videos or PDFs, you should declare them in your web.config file like this:<\/p>\n<pre><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<configuration>\r\n  <system.webServer>\r\n\t  <staticContent>\r\n\r\n\t\t<!-- Proper svg serving. Required for svg webfonts on iPad -->\r\n\t\t<remove fileExtension=\".svg\" \/>\r\n\t\t<mimeMap fileExtension=\".svg\" mimeType=\"image\/svg+xml\" \/>\r\n\t\t<remove fileExtension=\".svgz\" \/>\r\n\t\t<mimeMap fileExtension=\".svgz\" mimeType=\"image\/svg+xml\" \/>\r\n\r\n\t\t<!-- HTML4 Web font mime types -->\r\n\t\t<!-- Remove default IIS mime type for .eot which is application\/octet-stream -->\r\n\t\t<remove fileExtension=\".eot\" \/>\r\n\t\t<mimeMap fileExtension=\".eot\" mimeType=\"application\/vnd.ms-fontobject\" \/>\r\n\t\t<remove fileExtension=\".otf\" \/>\r\n\t\t<mimeMap fileExtension=\".otf\" mimeType=\"font\/otf\" \/>\r\n\t\t<remove fileExtension=\".ttf\" \/>\r\n\t\t<mimeMap fileExtension=\".ttf\" mimeType=\"application\/octet-stream\" \/>\r\n\t\t<remove fileExtension=\".woff\" \/>\r\n\t\t<mimeMap fileExtension=\".woff\" mimeType=\"font\/x-woff\" \/>\r\n\t\t<remove fileExtension=\".woff2\" \/>\r\n\t\t<mimeMap fileExtension=\".woff2\" mimeType=\"font\/x-woff2\" \/>\r\n\t\t<remove fileExtension=\".crx\" \/>\r\n\t\t<mimeMap fileExtension=\".crx\" mimeType=\"application\/x-chrome-extension\" \/>\r\n\t\t<remove fileExtension=\".xpi\" \/>\r\n\t\t<mimeMap fileExtension=\".xpi\" mimeType=\"application\/x-xpinstall\" \/>\r\n\t\t<remove fileExtension=\".safariextz\" \/>\r\n\t\t<mimeMap fileExtension=\".safariextz\" mimeType=\"application\/octet-stream\" \/>\r\n\r\n\t\t<!-- HTML5 Audio\/Video mime types-->\r\n\t\t<remove fileExtension=\".mp3\" \/>\r\n\t\t<mimeMap fileExtension=\".mp3\" mimeType=\"audio\/mpeg\" \/>\r\n\t\t<remove fileExtension=\".mp4\" \/>\r\n\t\t<mimeMap fileExtension=\".mp4\" mimeType=\"video\/mp4\" \/>\r\n\t\t<remove fileExtension=\".ogg\" \/>\r\n\t\t<mimeMap fileExtension=\".ogg\" mimeType=\"audio\/ogg\" \/>\r\n\t\t<remove fileExtension=\".ogv\" \/>\r\n\t\t<mimeMap fileExtension=\".ogv\" mimeType=\"video\/ogg\" \/>\r\n\t\t<remove fileExtension=\".webm\" \/>\r\n\t\t<mimeMap fileExtension=\".webm\" mimeType=\"video\/webm\" \/>\r\n\r\n\t\t<!-- Other types -->\r\n\t\t<remove fileExtension=\".pdf\" \/>\r\n\t\t<mimeMap fileExtension=\".pdf\" mimeType=\"application\/octet-stream\" \/>\r\n\r\n\t  <\/staticContent>\r\n\r\n\t  <!-- other settings, e.g. rewrite rules -->\r\n\r\n  <\/system.webServer>\r\n<\/configuration><\/pre>\n<h2>Enable Caching<\/h2>\n<p>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.<\/p>\n<p>Unfortunately, installing WinCache extension from the IIS homepage may break WordPress plugin updates. This is easily fixed by installing the latest repo version manually.<\/p>\n<p>Download the latest development version from the&nbsp;<a href=\"https:\/\/sourceforge.net\/projects\/wincache\/files\/development\/\" target=\"_blank\" rel=\"nofollow noopener\">WinCache SourceForge<\/a>&nbsp;and extract it to your PHP extension directory (e.g.&nbsp;<em>C:\\Program Files (x86)\\PHP\\v7.0\\ext<\/em>).<\/p>\n<p>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&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/w3-total-cache\/\" target=\"_blank\" rel=\"nofollow noopener\"><strong>WP Total Cache<\/strong><\/a><strong>&nbsp;won\u2019t work with IIS<\/strong>. We recommend using&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/wp-super-cache\/\" target=\"_blank\" rel=\"nofollow noopener\">WP Super Cache<\/a>&nbsp;instead, as it supports IIS and WinCache.<\/p>\n<p>Check out other iOS development&nbsp;<a href=\"https:\/\/blog.zaven.co\/category\/tutorials\/\" target=\"_blank\" rel=\"noopener\">tutorials<\/a>&nbsp;on our blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress hosting is dominated by linux-based platform 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"h5ap_radio_sources":[],"footnotes":""},"class_list":["post-5113","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/pages\/5113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5113"}],"version-history":[{"count":0,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/pages\/5113\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}