I have installed nginx, and things work very well for production, but I sometimes have this problem when developing.
To reproduce the problem, I have done the following:
Create a file in a public folder named test.html with the text "hello".
Open test.html in a browser, correctly displays "hello".
Modify file test.html to contain text "hello world".
Load the webpage, still says "hello".
My first guess was that my browser was caching this, but I tried clearing the cache, and even using a different browser, or just raw wget, but it's all the same.
I investigated the access logs, and found that when the change was made, it is indeed being noticed, because there are two accesses with status 200, and any subsequent reloads without changes is 304.
Also, the server is running in a virtual machine and getting the files from a linked folder, so I suspected that perhaps the VM could not see the file correctly, but loading it up in the VM shows the changes fine.
Restarting nginx does not help, either. Restarting the entire VM does, but this would be terrible to have to do every time. New files are reflected fine, it's just modifications to existing files that is troublesome. To the best of my knowledge, I have not set up any kind of caching.
My suspicion is that nginx is doing some kind of caching, either on disk or in memory, and despite noticing that the file has changed, it still returns the old cached version when asked.
Just looking for some possible solutions?
I looked through the configuration files and found something I didn't understand that looked fishy:
Commenting out this line fixes the problem. Can somebody explain what this does better than http://articles.slicehost.com/2007/12/13/ubuntu-gutsy-nginx-configuration-1/ ?
Information added to the Nginx wiki: http://wiki.nginx.org/Pitfalls#Config_Changes_Not_Reflected