Serve static assets with an efficient cache policy

If you are getting the following message Serve static assets with an efficient cache policy while using Lighthouse for youur site optimization, then you need to follow the following steps:

Add the following settings to your site config file in Nginx. You can open it via:

sudo nano /etc/nginx/sites-available/<yoursite>

and paste the following text:

    # Images
    location ~* \.(?:webp|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$ {
      expires 60d;
      access_log off;
      add_header Cache-Control "public";
    }

    # Web fonts
    location ~* \.(?:woff2|woff|eot|otf|ttf)$ {
      expires 60d;
      access_log off;
      add_header Cache-Control "public";
    }

    # CSS and Javascript
    location ~* \.(?:css|js)$ {
      expires 60d;
      access_log off;
      add_header Cache-Control "public";
    }

Above, the expiry is set for different types of files for 60days. You can change it based on your own requirements.