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)

8
  • 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? Jun 21, 2012 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, 2012 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 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. Jun 21, 2012 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, 2012 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. Jun 22, 2012 at 13:31

2 Answers 2

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.

1
  • Note for some reason I had a nginx.config-dist also and had to edit it and set sendfile off.
    – AaronLS
    Sep 2, 2013 at 5: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.

7
  • It responds with proper headers and all browsers work the same for me.
    – A123321
    Jun 21, 2012 at 21:27
  • To prove this I also tested the same files on my Apache 2.4 server and it works fine.
    – A123321
    Jun 22, 2012 at 7:43
  • The content length header also changes.
    – A123321
    Jun 22, 2012 at 8:28
  • Compare your configuration to the default, perhaps with a "diff" if you have the original files, and see what else has changed. Jun 22, 2012 at 11:26
  • I have default configuration everywhere (but I tried turning gzip on and off - with no result). This is my virtual host settings pastebin.com/UKnBQnZK
    – A123321
    Jun 22, 2012 at 11:33

You must log in to answer this question.

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