Plesk

Apache and Nginx Settings – Configuring the “Expires” Header

The Apache expires header governs how long web browsers can keep
cached copies of your web content before requesting it again from the
server. Configuring this header can decrease the server load and speed
up your website.

For example, you set the expiration period to 10 days. A visitor browses
your website, requesting its index.html page. The visitor’s web
browser stores a copy of the page in its cache, and for the next 10 days
it would serve the cached copy every time the visitor browses your
website. On the eleventh day, if the page is requested again, the
browser would request the page again from the server, because the one it
stores in the cache is past its expiration date.

When configuring the expires header for websites featuring dynamic
content, we recommend enabling the response with Expires headers for
static files only
 option. Otherwise, all content, including dynamic
content, will be stored in the visitors’ browsers’ cache for the
duration of the expiration period. This is not recommended, because the
dynamic content is, as a rule, updated frequently.

To configure the “Expires” header:

  1. Go to Websites & Domains > Apache & nginx Settings.
  2. Under Expires, select the Enter custom value radio button.
  3. Specify the desired expiration period (the recommended length of the
    expiration period is 14 days).
  4. If your website features dynamic content, make sure that the
    response with Expires headers for static files only checkbox is
    selected.
  5. Click OK.

Note: If nginx is enabled, only files served by Apache will have the
expires header. If the Smart static files processing checkbox is
selected, which files are treated as static is determined by the
Apache and nginx default configurations. If the Serve static files
directly by nginx
checkbox is selected and any file extensions are
specified, nginx only serves the files with the specified extensions.