yumupgrades for production use, this is the repository for you.
Active subscription is required.
Magento 2 server
The fine settings below require a properly configured server, to begin with. At a minimum you need:
- HTTP/2 capable web server (NGINX)
- Magento 2 cron setup to run every minute
- Far Future Expire header on static assets
All the settings below are available in the Magento administration area
Stores -> Configuration -> Advanced -> Developer
|Grid Settings||Asynchronous indexing||Enable||Avoids the locks that occur when data is saved, and to reduce processing time|
|CSS Settings||Minify CSS Files||Yes||Self-explanatory|
|Template Settings||Minify HTML||Yes|
|Static Files Settings||Sign Static Files||Yes||Will ensure cache busting for static assets which use Far Future Expiry headers|
Stores -> Configuration -> Sales -> Sales Emails
|General Settings||Asynchronous Sending||Enable||Obviously it’s good to have emails fired by cron. User cancelling the page won’t result in missed emails. Another plus is PHP-FPM pool won’t suffer from waiting on an email to be sent.|
Stores -> Index Management
Set all indexers to “Update on Schedule” mode. Configure indexers to run on schedule and in parallel.
Stores -> Settings -> Configuration -> Catalog -> Catalog
Switching to production mode improves storefront responsiveness and prevents long initial page load times that can occur in default mode. Make sure to run the switch to production mode after you have set most of the settings above. In some versions the “Developer” section is not visible after switching to production mode!
Run the following commands to switch to production mode:
bin/magento deploy:mode:set production
The script (for 2.2.4 and above)
Instead of tinkering around the admin area, it is better to run a few commands and be done with it.
Here’s the script to set production-ready Magento settings. Note on
--lock-* parameters which are available only with versions 2.2.4 and higher. The
--lock-env is for system specific configuration and the
--lock-config is for all environments (e.g. will apply to staging and dev environments, because the config value will be written to
#!/bin/bash bin/magento config:set --lock-env dev/js/minify_files 1 bin/magento config:set --lock-env dev/css/minify_files 1 bin/magento config:set --lock-env dev/css/merge_css_files 1 bin/magento config:set --lock-config dev/js/enable_js_bundling 0 bin/magento config:set --lock-config dev/js/merge_files 0 bin/magento config:set --lock-config dev/static/sign 1 bin/magento config:set --lock-config sales_email/general/async_sending 1 # the following seems like two settings for the same thing, who knows? :) bin/magento indexer:set-mode schedule bin/magento config:set --lock-config dev/grid/async_indexing 1 # allow indexers to run in parallel for multistore (>= 2.2.6) bin/magento indexer:set-dimensions-mode catalog_product_price website bin/magento app:config:import cachetool opcache:reset
For a list of server related settings to speed up your Magento 2, have a look at the complete Magento 2 performance checklist.