Question

How to add expiry header in NGINX?

  • Posted November 26, 2013

Tried to add this one- location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { expires 30d; log_not_found off; }

But it didn’t worked,that stopped the server. Any solution?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Check out the Nginx wiki: <a href=“http://wiki.nginx.org/HttpHeadersModule”>ngx_http_headers_module</a>.

Are there any errors in the error log file? <br><pre>sudo tail /var/log/nginx/error.log</pre>