This is part 3 of 3 of this series and if you’ve been following, it describes how we improved our blog performance by installing Nginx and applying other technologies.
You can read Part One of this series here if you haven’t already seen it. Part One describes how we started out using the LAMP (Linux, Apache, MySQL, and PHP) stack on this website but changed the setup by adding Nginx to improve performance.
Part Two of this series which can be found here also describes how we setup Nginx and PHP-FPM caching module. Using these two packages helped speed up the website by caching frequently accessed content.
We’ll finish up in Part Three with putting all these technologies together to complete the puzzle. It’s a great setup and you’re free to apply it on your sites as well.
If you started out with Part One and Part Two of this series, then by now you’ve installed Nginx, MySQL,PHP-FPM and other packages. You’ve also configured Nginx basic settings with PHP-FPM module defined settings.
You could easily copy the settings in Part One and Part Two and paste them in the appropriate files on your server. Or follow the guides and try to duplicate it in your environment.
With Nginx and PHP-FPM configured, open php.ini file in the /etc/ directory and add the below line for better experience when using WordPress and Nginx.
cgi.fix_pathinfo = 0;
When you’re done with setting up Nginx and PHP-FPM, test your site to see if it’s responding to requests and functioning. If it’s functioning, then you’re good.
Next, download WordPress file and move its content to the root directory of your webserver. The root directory is defined in Nginx.conf file. Check Part Two to find the root directory. When you’ve defined WordPress connection settings (MySQL username and password) in wp-config.php file, logon and install WordPress.
Once everything is done, you should see WordPress default theme page. It’s up to you to customize or change it.
Install plugins and themes as you wish but make sure to keep it at a minimum. One important plugin we installed in WordPress is W3 Total Cache. We installed it but only enabled Object and Database Cache. Page Cache and other caches are being handled by Nginx and PHP-FPM.
Just to finish things up, we also signed up for Google PageSpeed Service to handle traffic. Read this blog post to learn how to setup PageSpeed in Nginx.
Because we used PageSpeed we also installed this WordPress plugin to help with X-Forwarded-For.
This is it! There maybe other tweaks but applying these settings to your site will definitely have an impact on performance. So go ahead and try it and see what performance gain your site may get.
Feel free to change some settings here that do not work in your environment, but most of the settings should work on most servers.