Magento – Nginx as reverse proxy server instead of varnish in Magento 2

magento2nginxvarnish

I've setup a store on Magento 2 that is going to go live soon. I wanted to implement Varnish, but my hosting says that it is not compatible with cPanel. They did install it, but they're facing problem when they run it. They're suggesting that I use nginx as reverse proxy server instead. I've little knowledge of servers and don't know how that can be done. I've searched the web but can't find a concrete document that explains how to use nginx as full page caching / reverse proxy server, just like how Magento 2 uses varnish. My objective is of course to speed up my site.

I'm also confused on how Magento 2 would interact with nginx as a proxy server instead of Varnish since it does not have built in support for nginx. For instance, would Magento 2 automatically purge a product page that is cached if say price of that product is updated on the backend?

Can someone kindly brief me and let me know on how to achieve my goal. Would be grateful for all the help. Thank you.

Best Answer

Magento requires that cache storage allows cleaning values by tags. Nginx do not support it. So, you cannot implements full functionality in stock Nginx at all.

But if not valid data for some time is valid for you business, you can enable php implementation of FPC and add cache in nginx with invalidation by time