Website visitors and search engines love sites that perform better. A factor that can affect this rank is how assets like images, CSS and JS files are cached by visitors’ web browsers.
During development, you may not want the following settings on for testing. Once a site goes live, however, the example below will increase your Page Speed score—you may wish to set a longer expires
line like 14d for two weeks, or 30d for thirty days. Apply the following to your Web Rules to leverage browser caching.
location ~* \.(?:css|js|jpe?g|ico|png|gif|svg|pdf|mov|mp4|mp3|woff|ttf|eot)$ {
expires 14d;
add_header Pragma public;
add_header Cache-Control "public";
gzip_vary on;
}
location / {
try_files $uri $uri/ @modx-rewrite;
}
Note: This is not enabled by default to make developing sites more straightforward, by not requiring force-refresh to see changes in CSS and images, for example.