This is the final post of this series that will detail the final steps of my experience switching from Apache to Nginx webserver. If you don’t already know, I’ve switched to Nginx webserver from Apache to host my WordPress blog. There were no particular reasons why I switched. Apache works great with WordPress and didn’t have any issues it.
So maybe my reason for switching was just to try something new because of all the good things I’ve read about Nginx. Now, if you don’t have any good reason for switching to Nginx webserver to run your blog, please don’t do it.
Before I started the process of switching to Nginx, I backed-up my web content and database files. Part One detailed the steps carefully. In Part One of this series, I created a backup of my WordPress content and its MySQL database. I then copy the data to an external Amazon Cloud Server because I wanted to completely rebuild the server.
In Part Two, I rebuilt the primary server, installed Nginx, PHP and MySQL database server, and then restored the web content and database file. You can read it here. In this this post (Part Three), I am going to detail the steps to verify and make sure WordPress will run on Nginx and PHP.
So, starting from where we left off in Part Two, we’re going to test if PHP is installed and ready. To do that, create a test file in the document root with the content below.
sudo vi /var/www/wordpress/test.php
Next, enter the content below into the file and save it.
Next, open a web browser and browse there to test PHP. If you see the page below, then PHP is working.yourdomain.com/test.php
You’ll also notice Nginx is functioning if you see the page below when you type localhost in your browser.
If these two services are functioning, all you have to do is extract WordPress content in the root directory. Our root directory is at this location: /var/www/wordpress
Next, open WordPress’ wp-config.php file and make sure the database name, user and password match what you created. When you’re don’t, open your browser and type localhost and WordPress will display its content.
That’s it! You’ve completely switched to Nginx webserver.