Would you like to learn how to disable the cache of files on the Nginx server? In this tutorial, we are going to configure the Nginx server to disable the cache of files.
• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Nginx 1.18.0
This will disable the cache of files on the user browser.
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Nginx – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Nginx.
Tutorial Nginx – Disable the Cache
Install the Nginx server.
Edit the Nginx configuration file for the default website.
Add the following headers to disable the cache of files.
Here is the file, before our configuration.
Here is the file, after our configuration.
Restart the Nginx service.
Optionally, disable the header named ETAG.
In our example, the remote user’s browser will not cache files from this Nginx server.
From a remote computer, try to access a page from the Nginx server.
Here is the command output.
In our example, the Nginx server uses the connection header to tell the user’s browser to not cache files.
Optionally, you may select only a list of file extensions to disable the cache.
Congratulations! You disabled the browser cache feature using the Nginx server headers.