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'm building a web server distributing variety kind of binary files. (with Ubuntu) They have vary extensions and sometimes has wrong extension. But currently, my Apache server serves unknown files as text. So I have to make my Apache2 serve all files as binary by default regardless of extension or any metadata except some explicit cases. How can I archive this?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Try this directive on your site configuration:

DefaultType application/octet-stream

Or this one:

DefaultType None

The default seems to be text/plain:

DefaultType Directive
Description:    MIME content-type that will be sent if the server cannot determine a type in any other way
Syntax: DefaultType MIME-type|none
Default:    DefaultType text/plain
Context:    server config, virtual host, directory, .htaccess

http://httpd.apache.org/docs/2.2/mod/core.html#defaulttype

share|improve this answer
    
This is correct, but I'll add two points: one, don't test with Internet Explorer, which tries to guess content types; use Firefox (or another decent browser). Also, DefaultType None should be the default configuration; check to make sure you aren't overriding this elsewhere. –  BMDan May 2 '11 at 4:27
    
I thought the same but the docs seem to point to text/plain as the default, see edit. –  Eduardo Ivanec May 2 '11 at 10:43

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.