How to Install WordPress on Windows Server 2016
Please share with your friends...
  • 1
  • 1
  •  
  •  
  • 1
  • 1
  •  
  •  
  •  
  •  
    4
    Shares


⇐ BackPageNext ⇒

Prerequisites

Sections in this post that contain multiple lines of PowerShell commands can be copied and pasted to your PowerShell command prompt all at once, and each command will be executed sequentially.

There are a couple prerequisite items required before beginning the main installation actions. To start, perform the following:

  1. Open a local Windows PowerShell (Admin) prompt, or you can establish a remote PowerShell session with a different networked computer using the following PowerShell command:
    Enter-PSSession COMPUTER -Credential USER

    Replace COMPUTER with the name of the networked computer, and USER with your administrative credentials.

  2. Change into the Downloads directory, using the following PowerShell command:
    cd ~\Downloads
  3. Set the Security Protocol Type for HTTPS downloads to TLS 1.2, using the following PowerShell command:
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Internet Information Services

Internet Information Services (IIS) 10 is a group of installable features in Windows Server 2016 and Windows 10 for providing high performance web services.

  1. Install Internet Information Services using the following PowerShell command:
    Windows Server 2016
    Install-WindowsFeature Web-Server,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-CGI,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Security,Web-Filtering,Web-Performance,Web-Stat-Compression,Web-Mgmt-Tools,Web-Mgmt-Service,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Net-Framework-Core -IncludeManagementTools
    Windows 10
    Enable-WindowsOptionalFeature -FeatureName IIS-WebServerRole,IIS-WebServer,IIS-CommonHttpFeatures,IIS-StaticContent,IIS-DefaultDocument,IIS-DirectoryBrowsing,IIS-HttpErrors,IIS-ApplicationDevelopment,IIS-CGI,IIS-HealthAndDiagnostics,IIS-HttpLogging,IIS-LoggingLibraries,IIS-RequestMonitor,IIS-Security,IIS-RequestFiltering,IIS-Performance,IIS-HttpCompressionStatic,IIS-WebServerManagementTools,IIS-ManagementConsole,IIS-ManagementService,WAS-WindowsActivationService,WAS-ProcessModel,WAS-NetFxEnvironment,WAS-ConfigurationAPI,NetFx3 -Online -All -Source D:\Sources\sxs

    You will require the Windows 10 installation media or ISO file to successfully execute this command.

  2. Enable the Remote Management Service, using the following PowerShell commands:
    Set-ItemProperty HKLM:\SOFTWARE\Microsoft\WebManagement\Server EnableRemoteManagement 1
    Set-Service WMSVC -StartupType Automatic
    Start-Service WMSVC
  3. Download and install the URL Rewrite 2.1 extension for IIS, which will enable Permalinks functionality in WordPress, using the following PowerShell commands:
    Invoke-WebRequest "http://download.microsoft.com/download/D/D/E/DDE57C26-C62C-4C59-A1BB-31D58B36ADA2/rewrite_amd64_en-US.msi" -OutFile "rewrite_amd64.msi"
    Start-Process "msiexec.exe" "/i rewrite_amd64.msi /qn" -Wait

File System Security PowerShell Module

The File System Security PowerShell Module adds a number of cmdlets to manage file system permissions not currently present in PowerShell. This module is only used to during installation, and can be removed later if so desired.

  1. Download and extract the File System Security PowerShell Module, using the following PowerShell commands:
    Invoke-WebRequest "https://gallery.technet.microsoft.com/scriptcenter/1abd77a5-9c0b-4a2b-acef-90dbb2b84e85/file/107400/19/NTFSSecurity.zip" -OutFile "NTFSSecurity.zip"
    Expand-Archive "NTFSSecurity.zip" "$env:ProgramFiles\WindowsPowerShell\Modules\NTFSSecurity"
  2. Set the PowerShell script execution policy to allow downloaded scripts to be run as long as they have been signed by a trusted publisher, using the following PowerShell command:
    Set-ExecutionPolicy RemoteSigned CurrentUser
⇐ BackPageNext ⇒

How to Install WordPress on Windows Server 2016

Please share with your friends...
  • 1
  • 1
  •  
  •  
  • 1
  • 1
  •  
  •  
  •  
  •  
    4
    Shares
Tagged on:                                                 

9 thoughts on “How to Install WordPress on Windows Server 2016

  • 09/03/2018 at 8:58 AM
    Permalink

    Thanks for posting this! I’ve not run the entire script yet, but have a question about what is best to do when an install file is no longer available (or has been moved to an “archive” folder). I think I recall that the original posting was about May 2017. Some of the versions listed in the script are not available, or not where they were originally. Thoughts?

    Reply
    • 10/03/2018 at 2:54 PM
      Permalink

      Hi there!
      I’ve updated the instructions and script to download the latest versions of MySQL (5.7.21) and PHP (7.1.15), plus address an issue with HTTPS downloading in PowerShell. Tested on fully patched versions of Windows Server 2016 (v1607 b14393) and Windows 10 (v1709 b16299) – all good. Also removed PHP 5.5 from the instructions, as this is well out of support now.
      Hope this helps 🙂
      Chris

  • 21/03/2018 at 3:00 AM
    Permalink

    Hello,

    Thanks for posting this great tutorial. I’ve run into an issue midway through and can’t continue. Any suggestions?

    PS C:\Users\webadmin\Downloads> Set-Content $MYSQL_INIT “ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘H*****’;”

    PS C:\Users\webadmin\Downloads> Content $MYSQL_INIT “CREATE DATABASE wordpress;”
    >> Add-Content $MYSQL_INIT “CREATE USER ‘wordpress’@’localhost’ IDENTIFIED BY ‘H******’;”
    >> Add-Content $MYSQL_INIT “GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpress’@’localhost’;”

    Get-Content : A positional parameter cannot be found that accepts argument ‘CREATE DATABASE wordpress;’.
    At line:1 char:1
    + Content $MYSQL_INIT “CREATE DATABASE wordpress;”
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-Content], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetContentCommand

    Reply
  • 14/06/2018 at 12:57 AM
    Permalink

    Is there a script to start from scratch?
    I had some issues and would like to reinstall ist, but how I do it?

    Reply
  • 28/06/2018 at 5:56 AM
    Permalink

    I was having a problem with Windows recognizing the “Install-WindowsFeature” command. I finally saw where someone had said not to use PS x86 for running a different script, so I switched to PS ISE and most of the commands ran without a problem. Or at least what wasn’t being downloaded was not due to running the wrong instance of PowerShell.

    Reply
  • 09/08/2018 at 12:01 PM
    Permalink

    The following is action #3 on Page2, but is missing from the PowerShell Script that has all the commands:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

    If you don’t include it, there are file downloads that will fail (and the cause might not be obvious). I actually found this command elsewhere, and added it, which made the file downloads work. I happened to start rehearsing the process and saw it was mentioned in 3. I then checked the entire script and I don’t think it is there. If so, I missed it.

    Reply
  • 09/08/2018 at 12:07 PM
    Permalink

    The install went fine and I have a working WP site. But, I wanted a multisite site, so I went through that process, wanting sub sites that are subdirectories. The main site works fine, but the subsite does not show the site theme, nor can you get to the subsite’s Dashboard. I haven’t tracked down the answer yet, but I am thinking it may be something to do with the “rewrites”.

    Reply
  • 07/11/2018 at 3:46 AM
    Permalink

    Great walkthrough. I have been installing an internal WordPress Intranet server/site and it took me a while to get wordpress and HTTPS working with a self-signed cert. I eventually found instructions regarding exporting the server CERT in Base 64 encoded X.509 format and then adding this certificate information to the end of the \wp-includes\certificates\ca-bundle.crt file. This along with downloading the latest bundle of root certs from https://curl.haxx.se/docs/caextract.html helped fix the problem.

    I also found that I had to use the following command to configure IIS – “dism.exe /online /enable-feature /all /featurename:NetFX3 /Source:G:\sources\sxs
    Install-WindowsFeature Web-Server,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-CGI,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Security,Web-Filtering,Web-Performance,Web-Stat-Compression,Web-Mgmt-Tools,Web-Mgmt-Service,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Net-Framework-Core -IncludeManagementTools”.

    This required including the source option and pointing to the windows DVD/CD drive and also installing NETFX3 as this seemed to be missing from my 2016 server build.

    I hope this might be of use to someone else as there aren’t many sites/articles concerning setting up worpress on IIS.

    Reply

Leave a Reply

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