• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

Why Using A Reverse Proxy Is Important For WordPress – Or LiteSpeed

By Bhagwad Park on January 5, 2022 0

Why Using A Reverse Proxy Is Important For WordPress – Or LiteSpeed

For a long time, I didn’t give much thought to caching static content on a server level. After all, I already use a CDN (Cloudflare), so why should I bother about how fast static files are served? A few days back as the previous year rolled over into the other, I understood how important it was to have a reverse proxy sitting in front of Apache to speed up serving not just dynamic, but static files as well. Here’s what happened.

Over the New Year, a bunch of legitimate bots crawled my site – Ahrefs, SemRush, and more. This continued over a few hours. They requested not just dynamic content, but every single image on my site. Here’s the spike in web traffic around 4:00 in the morning:

Spike in Web Requests Because of Bots
Spike in Web Requests Because of Bots

None of this was malicious. I checked the logs, and it was just normal bots requesting content every couple of seconds. Each file was requested just once, so they didn’t benefit from CDN caching. I then checked my page speed logs and found a huge increase in the response time of my site. Here’s the screenshot from Cloudflare’s page performance monitor:

Impact of Bots on Page Load Speed with Apache
Impact of Bots on Page Load Speed with Apache

Luckily, 4:00 am isn’t when I get my most important traffic. But you can see that the response times on my site really spiked when all those static files were being requested. I noticed the same thing on my Google Analytics page speed reports which I’ve configured to sample 100% of incoming requests.

This isn’t the first time I’ve seen this. It isn’t an issue that can be solved using caching plugins on WordPress or a CDN.

Why a CDN Doesn’t Help Here

CDN providers purge static files that aren’t accessed for about two days. I’ve tested this on all major CDN providers like Cloudflare, KeyCDN, and BunnyCDN. They all purge infrequent content. Every site has a large chunk of infrequently accessed content – I’d even say the bulk of images is barely accessed. All these files are uncached.

So when a bot systematically accesses your images one by one for indexing, all those requests hit your server directly. A CDN is great for handling traffic spikes to a few pages – the way human visitors work. But it simply isn’t helpful against bots pulling your files one by one.

Caching Plugins Don’t Solve This Either

Plugins like W3 Total Cache store static copies of your dynamic files. They still work through PHP and Apache. They don’t speed up the delivery of static content, and they wouldn’t have helped me deal with the traffic spike you see in the screenshots.

The fundamental problem here is that Apache by itself just doesn’t do very well in serving static content.

Solution 1: Use a Reverse Proxy like NGINX or Varnish with WordPress

This problem isn’t new. It’s the main reason why so many people use reverse proxies that sit in front of Apache and cache static content to serve it much faster than Apache can.

The consensus appears to be that NGINX is easier to set up than Varnish. Of course, you can’t do anything about this if you’re on shared hosting that doesn’t have a reverse proxy. But if you’re on a VPS, then you can try and set it up on your own. Engintron is a neat cPanel plugin for NGINX which lets you set up NGINX easily in a few clicks.

For other control panels, the setup is trickier.

Solution 2: Use LiteSpeed with NameHero

NameHero uses LiteSpeed, which performs just as well by itself as Apache does with NGINX as a reverse proxy. Here’s a feature comparison on the LiteSpeed website showing the difference between LiteSpeed, Varnish, and NGINX as a reverse-proxy.

If you already use NameHero as a web host, then you’re in luck – LiteSpeed is enabled on all shared hosting plans by default! So you don’t have to worry about situations like the one above where static files requested by robots slow down your site. LiteSpeed is already caching your static files and you don’t need to use a server-based reverse proxy like NGINX.

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • Why I Don’t Use AWS S3 For Website Backups
  • How To Add A “Vary: Accept-Encoding” Header To Apache
  • Managed vs Unmanaged VPS: The NameHero Difference
  • Why I Don’t Use Jetpack Backup
  • How To Share A Post Draft In WordPress
  • How To Use The Layout Grid Block By Automattic
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2022 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in