Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question
    
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. –  Andrew123321 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 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.) –  Andrew123321 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
show 3 more comments

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
Note for some reason I had a nginx.config-dist also and had to edit it and set sendfile off. –  AaronLS Sep 2 '13 at 5:28
add comment

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.

share|improve this answer
    
It responds with proper headers and all browsers work the same for me. –  Andrew123321 Jun 21 '12 at 21:27
    
To prove this I also tested the same files on my Apache 2.4 server and it works fine. –  Andrew123321 Jun 22 '12 at 7:43
    
The content length header also changes. –  Andrew123321 Jun 22 '12 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. –  Mark Stosberg Jun 22 '12 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 –  Andrew123321 Jun 22 '12 at 11:33
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.