Are you currently looking for the best server setup for high performance web server to host WordPress sites? Please consider using Nginx with Redis Cache.
While Nginx is a lightweight and high-performance web server per se, Redis adds the best caching solution for websites with large databases.
Combining Nginx and Redis Cache is one of powerful server setups recommended by many professional sysadmins out there.
However, installing and configuring both of them are not easy tasks for general users especially sysadmin newbies or individual users.
Thanks to WordOps for making Nginx and Redis setup a piece of cake.
Below you’ll learn how to build a WordPress site hosted on Nginx server with proper Redis Cache activated.
Set up a valid hostname using this command:
hostnamectl set-hostname host.example.com
Change host.example.com with your own.
Next, add at least three DNS entries on your DNS provider (2 A records, and 1 CNAME):
A example.com x.x.x.x
CNAME www.example.com example.com
A host.example.com x.x.x.x
In which x.x.x.x is server IP address. Useful guide: Using Cloudflare as DNS server.
Login to your server over SSH. Windows users usually use Putty while Linux users can use Terminal.
Issue this command to install WordOps:
wget -qO wo wops.cc && sudo bash wo
You may need to enter your name and email during the process.
Read more about detailed WordOps setup instruction with screenshot pics here.
Install Redis Server
Redis caching server does not come within WordOps default installation.
The package is bundled within WordOps stack. No need to worry though, the install process is easy and automatic.
Issue this command:
wo stack install
This will install Redis server along with other useful packages such as phpMyAdmin, Adminer, Netdata, File Explorer, Fail2ban, and WordOps Dashboard.
Install and Configure WordPress
Now you have Nginx, php-fpm, MariaDB, and Redis installed. Thanks to WordOps for that.
Next, you can install WordPress using only a single command line:
wo site create example.com --wpredis -le
Tasks performed by the command:
- Creating Nginx virtual host file for specified domain
- Downloading and installing WordPress
- Installing Redis Cache plugin, and
- Installing free Let’s Encrypt SSL certificate
You’ll get the admin username and password displayed. Use them to log in to WordPress dashboard page.
Also check out: How to Install WordPress in less than 5 minutes using WordOps.
Once logged in, go to Settings >> Redis.
Next, click the Enable Object Cache button.
As soon as the caching mechanism is enabled, you’ll see its status like following:
Purging Redis Cache
There are two methods to invalidate caches. First, using the Redis Cache plugin itself. Second, using Nginx Helper plugin.
The first option provides simplest solution. Simply click the Flush Cache button and all caches will invalidate.
The second option offers advanced solution.
You can define purge conditions and you can purge specific pages using Custom Purge URL.
While common users think installing Nginx and Redis is difficult, WordOps offers easier solution.
It’s not arduous at all.
What’s next? Do your best effort to get thousands of visitors to your site and see how your site is flying.
It’s hard to crash Nginx and Redis. Your WordPress site performs faster and sleek.