0

I have recently moved to Magento 2.4.4

My server currently is running on WHM with Nginx reverse proxy cache.

My Magento is using the built-in Redish Full Page Cache.

Recently I went to hire a freelancer to install and configure Varnish for me. But they have said:

  1. Varnish will clash with Nginx and they can not be installed together.
  2. Nginx with reverse proxy cache and php-fpm provides better performance than Varnish.

As I don't know much about this sort of thing, I was wondering what the community thinks of what the freelance sys admin has said?

Thank you in advance.

1 Answer 1

2

Nginx is a web server that has reverse caching proxy capabilities, whereas Varnish is a pure reverse caching proxy.

Nginx and Varnish do work together quite well, but only if Varnish is the reverse caching proxy, and Nginx is the web server.

I'm afraid the statement that Nginx with proxy cache will perform better than Varnish is not really true. I'm sure someone has found a use case in Magento where an individual request was faster on Nginx proxy cache with PHP-FPM, but in general Varnish is more suited.

I'm not saying Nginx is bad, I'm just saying that Nginx is the superior web server and Varnish the superior cache. It's a matter of staying in your lane.

From a simplicity point of view, only using Nginx is makes sense. Because when you use Varnish, you'll need Nginx as your web server, and you might need Nginx as your TLS proxy because Varnish (at least open source Varnish) doesn't offer native TLS support.

However, Varnish is far more flexible and in fact far better integrated in Magento. I'd argue it's worth the hassle. When it comes to cache invalidation, Varnish will do a far better job at granularly removing the right objects from the cache when Magento asks it to.

Have a look at https://www.varnish-software.com/developers/tutorials/configuring-varnish-magento/ for a detailed install guide for Varnish in Magento.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.