Deploy WordPress to Windows 2008R2 – Part I
Part 1 – Preparing the Windows 2008R2 Server
This is the first of a total of four posts about deploying Wordpress to a Windows 2008R2 remote server.
The matter is not straightforward for a few reasons:
- It is not easy to troubleshoot WordPress issues on Windows. Most WordPress gurus are of no help here because they have no experience using WordPress within Windows, as simple as that.
- Dealing with Windows 2008R2 deserves a long article of its own, as you may suspect.
- Tools from Microsoft, like Webmatrix and Webdeploy do not contribute at all to your knowledge. What I mean is that you follow the instructions, if something goes wrong you have no alternative but search forums and blogs, in other words use Google. So, you should resist with all your strengths in embarking into the easy road of doing things with click-once tools. That said, beware that for this series of posts I used WebMatrix in my Windows 7 development box, it was not a true time saver for me, but I followed the route most WordPress for Windows developers use, in order to make the situation more real.
So, imagine you have WebMatrix installed in your Windows 7 home or office computer, and developed a great WordPress website with it. Now, the time has arrived to publish that amazing site to your web server lodged in a Windows Server 2008R2 (dedicated, VPS or cloud) located somewhere in the World. You can use FTP, right? Unfortunately, FTP solves only part of the problem because WordPress sites store the real content and most of the configuration in a mySQL database. Without the mySQL database your site is just a bunch of templates, or so it looks. So, you must FTP the database as well, right? Unfortunately not. Here Microsoft proposes the use of Web Deploy, but I was never able to use it properly. Web Deploy has many caveats with WordPress, one of them is that it can’t fix URLs except in the simplest of cases. Let’s move on without Web Deploy!
As a side note, for people wondering why we are writing about dedicated, VPS or cloud servers instead of shared web hosts. Nowadays, lots of people have their own virtual servers because prices are low, and less and less people use slow shared web hosting for professional and corporate purposes. For instance, Amazon offers you, totally free during one year, a full fledged Windows Server 2008R2 (64-bit, of course) including a fair amount of bandwidth. Do you believe on this? Better you do, I will be using one for this article. Look at the image below:
So, you got a fresh installation of Windows 2008R2, like the one I got after I subscribed for my free micro EC2 at Amazon, then you had to go through the initial configuration steps, like Date and Time Settings, Keyboard selection, change the Computer name (not compulsory but recommended), and a few others. One thing I always do on new machines is configure the folder options in Windows Explorer, because I enjoy look at things as they are. Under the Organize menu of Windows Explorer, select Folder and search Options, then in the View tab, check “Show hidden file, folders and drives”, uncheck “Hide empty drives in the Computer folder”, uncheck “Hide extensions for know file type” and uncheck “Hide protected operating system files (Recommended)”. All right, I would never feel good until I completed this step.
But there is more!
- Now, launch Server Manager and add the role for Web Server. You may well select every Web Server service role or leave aside the ones you are sure you will never need, like let me say IIS 6 Management Compatibility, IIS Hostable Web Core, Clienet Certificate Mapping Authentication. Make sure you do not forget to add the CGI role, this is very important to our purpose.
- Now install Filezilla (last version at the time of this writing was 0.9.41). Of course, you can install another FTP server, but Fillezilla is probably the best and the price could not be better. If you are indeed using the free Amazon EC2 box I mentioned above you will spend some time learning how to open ports through the perimeter firewall. It is not very easy easy, and by default only the RDP port is open. Anyway, this is home work. As a hint, consider opening the following TCP ports through the perimeter firewall: 21, 25, 80, 110, 1433, 3389 (RDP, already done) . If you want to have a DNS server there consider opening UDP port 53. If you want to be able to ping the server consider allowing Echo Request ICMP packets to pass through. Note: Amazon EC2 boxes are quite good and fast, but for a production server you will need more than what is supplied with the free tiny box and then costs climb pretty fast because you pay for everything. My cost estimate for a production web server installed on the small model (above tiny) will be around $80.00 per month in Amazon. For this reason I keep all my production servers with Burst, I pay less than $24, have 2.5 GB RAM, 2.5 GB memory and 100 GB hard disk. But remote desktop to Burst is not as fast as to Amazon EC2 and server takes longer to boot, these are the real differences between cloud and VPS.
- Now launch the Windows Firewall Control Panel, enter an exception for Filezilla Server, add new Allow rule (Public/Domain/Private) for port 21 TCP. This should be enough, in most cases, to allow you to connect to Fillezilla Server from the Internet in “Active Mode” (I usually prefer this mode). For more about Active versus Passive FTP check this URL: http://slacksite.com/other/ftp.html. While we are configuring the Windows Firewall, add a Ping Echo Request rule, otherwise server can not be pinged from the internet.
- At this point you may want to disable the Enhanced Security from Internet Explorer (or alternatively, look for another internet browser). Disabling enhanced security is done as explained here: http://www.win2008r2workstation.com/disable-internet-explorer-enhanced-security/
This completes the preparation of our Windows 2008R2 Server.