Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx not serving updated static files

Tags:

nginx

Switching from apache to nginx, and encountering something weird.

1) Say I have a file yo.txt in the document root of my site and it contains 'foo'.

curl http://localhost/yo.txt => 'foo'

2) then I alter the file to contain 'bar'

curl http://localhost/yo.txt => 'foo' (still!)

If I remove yo.txt, I get a 404. If I remove all the text, I correctly get an empty file when I curl the url.

I checked the last modified HTTP header after I modify the file, and it is correct, even though the contents of the file are stale.

I'm using the standard configuration from nginx after an apt-get install nginx.

what gives?

like image 434
Josh Nankin Avatar asked Oct 12 '12 18:10

Josh Nankin


1 Answers

I'm using Vagrant. Setting sendfile to off in nginx.conf fixed the problem as found here, e.g."

sendfile off;
like image 156
Josh Nankin Avatar answered Oct 17 '22 09:10

Josh Nankin