Configure Magento Cloud
Magento Cloud environments have write restrictions, which means configuration changes related to static content and deployment cannot always be performed directly from the Admin Panel.
For this reason, Google PageSpeed Optimizer must be configured partly through the Magento configuration file.
Step 1: Locate the configuration file
Go to your Magento Cloud project root and open the file:
[root_store_path]/app/etc/config.php
This file contains global Magento configuration, including both native and extension-level settings.
Step 2: Add Google PageSpeed Optimizer configuration
Insert the configuration array inside the first-level array of config.php.
A typical configuration suitable for most Magento stores looks like this:
'system' => [
'default' => [
'dev' => [
'template' => [
'minify_html' => 1 // Minify HTML
],
'js' => [
'merge_files' => 0, // Merge JS files
'minify_files' => 1, // Minify JS files
],
'css' => [
'merge_css_files' => 1, // Merge CSS files
'minify_files' => 1, // Minify CSS files
]
]
],
'mst_optimize' => [
'optimize_js' => [
'enabled' => 1, // Enable JS optimizations (also enables advanced JS bundling)
'minify_js' => 1, // Minify JS files
'merge_js' => 0 // Merge JS files
],
'optimize_css' => [
'merge_css' => 1, // Merge CSS files
'minify_css' => 1 // Minify CSS files
],
'optimize_html' => [
'minify_html' => 1 // Minify HTML
]
],
],
Comments above explain which configuration corresponds to Magento’s built-in settings and which belongs to the Google PageSpeed Optimizer extension.
Be sure to remove the comments (// ...) before saving the file.
Step 3: Understand configuration structure
In this configuration:
- The
default/dev/...part includes Magento core optimization settings. - The
mst_optimize/...part includes Google PageSpeed Optimizer settings.
Because the extension extends Magento’s default optimization logic, these pairs should be synchronized. For example:
default/dev/template/minify_html↔mst_optimize/optimize_html/minify_htmldefault/dev/js/minify_files↔mst_optimize/optimize_js/minify_jsdefault/dev/css/minify_files↔mst_optimize/optimize_css/minify_css
Step 4: Adjust existing configuration
If your config.php file already includes any of these settings:
- Locate the existing keys in the array.
- Update them to match your desired optimization configuration.
- Ensure changes are reflected in both the
default/devandmst_optimizesections.
Step 5: Apply and verify configuration
After saving the file:
- Deploy your Cloud environment (commit and push changes).
- Run Magento upgrade and cache flush commands if needed:
bin/magento setup:upgrade
bin/magento cache:flush
- Verify optimization is active by checking your site in Google PageSpeed Insights or running:
bin/magento mirasvit:optimize-image:validate
Step 6: Manage other settings in admin panel
All other settings - including image optimization, lazy loading, and responsive image generation — can still be configured directly from the Magento admin panel:
Stores > Configuration > Mirasvit Extensions > Google PageSpeed Optimizer
Once configured properly, your Magento Cloud store will benefit from optimized CSS, JS, and HTML output without needing direct write access to static files.