5

I have nginx 1.2.0-1 on debian 6.0.5. I have file test.css. I fill it with "abcd1234". Open it in browser. Then I change the content to "mnop". I receive "abcd" in response.

I have all the files in folder shared between Windows (host) and Debian (guest) using Virtual Box. When I put the file elsewhere the problem does not occur!

Any idea what can cause this? Thank you

(I've been editing question as I was discovering the problem)

A123321
  • 153
  • 7
  • What do you mean by 'When I got more content it would usually "cache" it'? What do you mean by 'got' here? What is 'it' in each case here? – Mark Stosberg Jun 21 '12 at 21:08
  • (I edited the original post.) By got I meant that the file has got about 20 lines of CSS. "It would cache" - nginx would cache. – A123321 Jun 21 '12 at 21:20
  • How do you know that Nginx is caching the file and not your browser? If you are on Ubuntu Linux, I recommend installing the 'libwww-perl' package, and doing a 'HEAD -sSe http://url.com/'. It will never cache and will show you the response headers. Perl's LWP distribution can be installed with 'cpanm' on other desktops. – Mark Stosberg Jun 21 '12 at 21:24
  • I used wrong expression, it is not cached as in the usual meaning. I meant that part of the file stays the same - and other parts are missing or are filled with mentioned broken characters. (Just FYI I am on Windows, debian is in virtual machine.) – A123321 Jun 21 '12 at 21:31
  • It sounds like you've found that your problem has something do with this shared folder. I recommend checking the file system type of that folder. My assumption is that FAT32 would be the best choice. An alternate solution is to "ftp" or "scp" files between Windows and the virtual host. – Mark Stosberg Jun 22 '12 at 13:31
  • File system type is "vboxsf" and I doubt something else can be used :- / I hope some solution will appear. – A123321 Jun 22 '12 at 13:57
  • Although PHP works fine. Is there a way how to send static files not from nginx? – A123321 Jun 22 '12 at 14:03
  • _ Is there a way how to send static files not from nginx?_ Yes, use another web server, like Apache. – Mark Stosberg Sep 04 '13 at 12:48

2 Answers2

6

I believe you should disable 'sendfile' for Nginx. Search for 'sendfile' in your Nginx configs and change it from 'on' to 'off'. It can go in your 'http{}' block:

sendfile off;

See this post about the interaction between Nginx, vboxsf and sendfile.

Mark Stosberg
  • 3,901
  • 24
  • 28
2

One thing you'll want to check is the Content-Type header that is being sent out.

Open Chrome's Developer tools to the "Network" tab and load the CSS file again. Click on file name on the left side, and then on the "Headers" tab and scroll down to the Response Headers. You'll find a line like this:

Content-Type:text/html; charset=UTF-8

Does it match what you intended? If so, the issue may be in your browser settings. Do you get the same result in a second browser? If not, the issue is in your browser settings for one of your browsers.

Mark Stosberg
  • 3,901
  • 24
  • 28