Nginx – Expires directive returned in the ngix server response header

nginx

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?

Best Answer

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.