I have configures Nginx as reverse proxy/caching server to my apache webserver.

In the nginx config file I have setting of expires 30D at the server level. My apache config file has no expires directive , i mean no directive in the file. When I inspect my server response headers wchih seem to come from Nginx, I see the following for my http://www.example.com request:

****HTTP/200 responses are cacheable by default, unless Expires, Pragma, or Cache-Control headers are present and forbid caching. HTTP/1.0 Expires Header is present: Thu, 19 Nov 1981 08:52:00 GMT Legacy Pragma Header is present: no-cache**

Can someone please suggest what is wrong , i want to set the expires to 1 month from now but it shows Thu, 19 Nov 1981 08:52:00 GMT.

Where should i start?


1 Answer 1


If you are using Apache behind Nginx, then I assume you have a dynamic site. So, I guess http://www.yoursite.com serves dynamic content. By default, Nginx sets expires only for static files. So, please do the same test for a static file such as http://www.yoursite.com/style.css and you might notice the difference now.

  • I placed the following directive in nginx.confI checked the Expires tag for static content.
    – Andy
    Feb 5, 2012 at 2:18
  • i placed the following config in nginx.conf location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires 60d; }
    – Andy
    Feb 5, 2012 at 2:19
  • and restarted the server. still it shows me the Thu, 19 Nov 1981 08:52:00 GMT for the expires value. please help.
    – Andy
    Feb 5, 2012 at 2:20
  • You may want to add the following just after/before expires directive that sets the max-age to 10hours... add_header Cache-Control "max-age=86400, public, must-revalidate" Feb 5, 2012 at 4:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .