How to Disable ETags in NGINX


disable etags in apache

ETags (Entity Tag) are hash generated based on inode number, last modified time, or file size. It improves cache validation and saves data bandwidth. However, if your website used multiple back end servers, then it might result in differing ETag values across different servers, and slow down your website. In that case, you might want to disable ETags on your website. Here’s how to disable ETags in NGINX.

 

Please note : It is not advisable to disable ETags on your website. It can mess up caching.

 

How to Disable ETags in NGINX

Here are the steps to disable ETags in NGINX.

1. Open NGINX config file

Open NGINX config file in a text editor.

You will find it at one of the following locations, depending on the type of installation


/etc/nginx/conf.d/default.conf
/etc/nginx/sites-enabled/default
/etc/nginx/nginx.conf

 


$ sudo vim /etc/nginx/nginx.conf

 

2. Disable ETags

You can disable ETags on your website by simply adding the following line in http block of your website.

etag off;

 

3. Reload NGINX web server

Test the config file to ensure there are no errors.

$ sudo nginx -t

 

If you get no error message, reload NGINX server to apply changes.

$ sudo service nginx reload

 

That’s it! Now NGINX will automatically disable ETag on your website.

About Sreeram Sreenivasan

Sreeram Sreenivasan is the Founder of Ubiq, a business dashboard & reporting platform for small & medium businesses. Ubiq makes it easy to build business dashboards & reports for your business. Try it for free today!