Try Now

How to Leverage Browser Caching on Nginx

Unlike Apache, Nginx does not have a directory-level configuration, so SpeedyCache cannot automate the process of enabling browser caching. Instead, you must manually enter the Leverage Browser Caching config into your Nginx configuration file.
To enable Leverage Browser Caching on Nginx follow the steps below:-

  • Look for Nginx config file at  /etc/nginx/nginx.conf
  • In that file paste the following code inside the server block.

location ~* \.(css|js|ico|gif|jpeg|jpg|webp|png|svg|eot|otf|woff|woff2|ttf|ogg)$ {

expires max; 

}

After saving this configuration restart your Nginx server the browsers will start to cache your website according to the defined caching policy.

In case you face any issues feel free to contact our support, we would be glad to help.

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list