eBook | Listrak vs Klaviyo: Our eCommerce Email & SMS Marketing Platform Review LEARN MORE >
Book a Call

Using Nginx For Magento 2 Speed Optimization

May 17, 2023
2 Min Read

Traditionally, discussions about performance eCommerce optimizations are about code refactoring, database design, and other application-specific tweaks. However, evaluating your infrastructure from one level higher can be as equally important in the ability to serve your customers.

Download Guide Book -  Shopify vs Magento The Ultimate eCommerce Platform Comparison V3

Shopify vs Magento: Our Platform Comparison

Download eBook

One of the key pieces of your overall environment is your web server – the software that handles the connection from a visitor and passes it along to the Magento design platform. You may already be familiar with two of the biggest names: IIS and Apache. Because Apache is installed by default in most Linux-based installs, it’s also used as the default choice in running much of the web’s content.

But many of Apache’s strengths – its robust feature set, with the flexibility to use it with nearly every web-based technology – are also its biggest weaknesses; all of those features, while nice, can contribute to what’s known as software “bloat”. The desire for faster and more streamlined services has made way for other choices that may help increase your user’s experience.

Nginx (pronounced “Engine-X”) is one such platform rising in popularity. Its goal is to provide the highest concurrency (number of simultaneous connections/users) with the lowest resource footprint (CPU and Memory usage). Simply put, it can help you serve pages to more customers in relatively less time.

One way Nginx achieves this is by doing as little as possible. By that, I mean the webserver is there to simply handle the request. The bulk of the work is passed off directly to a pool of waiting PHP processes (if you‘ve configured PHP with the built-in “FPM” module), which ends up reducing a lot of overhead. Less webserver overhead means more resources available to PHP, which is where 80% of the work needed to power your Magento design comes from.

Of course, where there are benefits, there are drawbacks. Or really, just one perceived ‘drawback’ – Nginx doesn’t support Apache-style .htaccess control files. The reasoning is simple enough: having to check for and parse the overrides gives a relative hit in performance. By pre-defining your rewrites in the webserver configuration files, Nginx can know immediately how to handle the request.

What does all of this have to do with Magento development? While it’s certainly not Magento-specific, it still directly affects what you’re trying to do – provide a fast, stable storefront in which to serve your customers. Many benchmarks have consistently put Nginx ahead of Apache in terms of performance and scalability. Even Magento's website (now Adobe Commerce) utilizes it. By approaching your infrastructure from all sides, you give yourself a greater chance for success in the eCommerce solutions marketplace.

Guide Form -  Shopify vs Magento The Ultimate eCommerce Platform Comparison

Shopify vs Magento:
The Ultimate eCommerce Platform Comparison

Explore tags:
Share this article:
About the author
Owner & CEO

Founder & CEO of Groove Commerce https://ethangiffin.com

Let's Grow Your eCommerce Business, Together.