13.06.2015 Views

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ForceType image/jpg<br />

<br />

7.3 mod mime magic<br />

• Determines file type based on content of file.<br />

• Runs <strong>the</strong> file program <strong>to</strong> determine<br />

• magic.conf contains mappings <strong>to</strong> mime types<br />

7.4 Encoding<br />

• Usually compression<br />

• Can be o<strong>the</strong>r encoding, such as uuencode<br />

• Is additional <strong>to</strong> content type<br />

• Can have multiple file extensions <strong>to</strong> convey this information<br />

• resume.doc - Microsoft Word document<br />

• resume.doc.zip - PKZipped Microsoft Word document<br />

• The default is that a file is sent as is, with no encoding<br />

7.4.1 AddEncoding<br />

• Adds an encoding mapping <strong>to</strong> a particular file extension<br />

• AddEncoding pkzip .zip<br />

• AddEncoding gzip .gz<br />

7.4.2 RemoveEncoding<br />

• RemoveEncoding gz<br />

• Removes any encoding that has been associated with <strong>the</strong> specified file extension<br />

This directive has been useful on <strong>the</strong> <strong>Apache</strong> download site itself. Files with a .tar.gz file extension should<br />

probably not be sent with a gzip encoding, as this will cause <strong>the</strong>m <strong>to</strong> be uncompressed upon arrival, which<br />

is typically not <strong>the</strong> desired behavior. Likewise, on <strong>the</strong> <strong>Apache</strong> site, we want .tar.gz.asc files that contain <strong>the</strong><br />

gpg signature for <strong>the</strong> corresponding .tar.gz file, but are not <strong>the</strong>mselves ei<strong>the</strong>r a .tar or a .gz file. Thus, when<br />

sent with a gzip content encoding, <strong>the</strong>y arrive as a zero-byte file, since <strong>the</strong>re is no valid gzip content in <strong>the</strong><br />

file.<br />

40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!