[APACHE DOCUMENTATION]

Apache HTTP Server Version 1.3

Module mod_mime

ÀÌ ¸ðµâÀº À¥¼­¹ö°¡ ÀνÄó¸® ÇÒ¼ö ÀÖ´Â ÄÁÅÙÃ÷Çü½Ä(MIME-TYPE)¼³Á¤¿¡ °ü·ÃµÈ ¸ðµâ·Î¼­ mod_mime.c È­ÀÏ¿¡ °ü·ÃÄڵ尡 Æ÷ÇԵǾî ÀÖ´Ù.

Summary

ÀÌ ¸ðµâÀº ¹®¼­¿¡ ´ëÇÑ "meta information" ÀÇ ´Ù¾çÇÑ ºñÆ®¸¦ °áÁ¤Çϴµ¥ »ç¿ëÇÑ´Ù. ÀÌ Á¤º¸´Â ¹®¼­ÀÇ ÄÁÅÙÃ÷¿Í °ü·ÃµÇ°í, ºê¶ó¿ìÀú ¶Ç´Â ¼­¹ö³»¿¡¼­ content-negotiation(ÄÁÅÙÃ÷-ÇùÀÇ) ·Î »ç¿ëµÈ´Ù. °Ô´Ù°¡ "handler" ¸¦ ¼³Á¤ÇÒ ¼ö ÀÖ´Àµ¥, ¼­¹ö³»¿¡¼­ ¾î¶»°Ô ¹®¼­¸¦ ó¸®ÇÒ Áö¸¦ °áÁ¤ÇÑ´Ù. 

¼±¾ð AddCharset, AddEncoding, AddHandler, AddLanguage ±×¸®°í AddType µéÀº ¸ðµÎ meta-information ¿¡¼­ ¸ÅÇÎµÈ ÆÄÀÏ È®ÀåÀÚ ¸¦ »ç¿ëÇÑ´Ù. °¢°¢ character set, content-encoding, handler, content-language, ±×¸®°í ¹®¼­ÀÇ ÆÄÀÏÇü½Ä ( MIME-type ; content-type) À» ÁöÁ¤ÇÑ´Ù. ¼±¾ð TypesConfig ´Â MIME types ¿¡ °üÇÑ ¸ÅÇÎÀÌ µÇ¾î ÀÖ´Â ÆÄÀÏÀ» ÁöÁ¤Çϴµ¥ »ç¿ëÇÑ´Ù. ¼±¾ð ForceType °ú SetHandler ´Â ºÎºÐÀûÀ¸·Î MIME type À̳ª Çڵ鷯(handler) ¸¦ ÁÖ¾îÁø À§Ä¡ (e.g., a particular directory) ¿¡ ÀÖ´Â ÆÄÀϵé°ú Á¶ÇÕ½ÃŰ´Â µ¥ »ç¿ëµÈ´Ù. 

ÆÄÀÏÀÇ Çü½ÄÀ̳ª ÀÎÄÚµùÀ» º¯°æÇÑ´Ù°í ÇØ¼­ Last-Modified header °¡ º¯°æµÇÁø ¾Ê½À´Ï´Ù. ±×·¯¹Ç·Î, ±âÁ¸¿¡ ij½¬µÈ º¹»çº»Àº ¿©ÀüÈ÷ ±âÁ¸ÀÇ Çì´õ¸¦ °¡Áö°í Ŭ¶óÀÌ¾ðÆ®³ª ÇÁ¶ô½Ã¿¡ ÀÇÇØ¼­ »ç¿ëµÇ°í ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. 

Files with Multiple Extensions

µÎ°³ÀÌ»óÀÇ È®ÀåÀÚ¸¦ °¡Áø ÆÄÀÏ : ÆÄÀÏÀº ÇϳªÀÌ»óÀÇ È®ÀåÀÚ¸¦ °¡Áú ¼ö ÀÖ½À´Ï´Ù. ±×¸®°í È®ÀåÀÚÀÇ ¼ø¼­¿¡´Â º¸Åë »ó°üÀÌ ¾ø½À´Ï´Ù. ¿¹¸¦ µé¸é ¸¸¾à ÆÄÀÏ welcome.html.fr ÀÌ ÄÁÅÙÃ÷Çü½Ä text/html °ú ¾ð¾î ÇÁ¶û½º·Î ¸ÅÇεǾú´Ù°í Çϸé, ÀÌ ÆÄÀÏÀº welcome.fr.html ·Îµµ Á¤È®È÷ °°Àº Á¤º¸·Î ¸ÅÇ뵃 ¼ö ÀÖ½À´Ï´Ù. ´Ü ÇϳªÀÇ ¿¹¿Ü´Â ¾ÆÆÄÄ¡°¡ ¾î¶»°Ô ó¸®ÇØ¾ß ÇÒÁö ¸ð¸£´Â È®ÀåÀÚ¿¡ ´ëÇÑ °ÍÀÔ´Ï´Ù. ÀÌ °æ¿ì¿¡¼­ ¾Ë¼ö ¾ø´Â È®ÀåÀÚ·Î ³²°ÜÁø È®ÀåÀÚ·Î ºÎÅÍ ¾òÀº ¾î¶² Á¤º¸µµ ¹«½ÃÇÕ´Ï´Ù. ¸¸¾à È®ÀåÀÚ fr °ú html Àº ¾ð¾î¿Í ÄÁÅÙÃ÷Çü½Ä¿¡ ¸ÅÇεǾî ÀÖÁö¸¸, È®ÀåÀÚ xxx ´Â ¾î¶²°Í¿¡µµ ÇÒ´ç µÇ¾î ÀÖÁö ¾ÊÀ» °æ¿ì welcome.fr.xxx.html ´Â  ÄÁÅÙÃ÷ Çü½Ä text/html ¿¡´Â ¿¬µ¿°üµÇÁö¸¸, ¾ð¾î¿¡´Â ¿¬µ¿µÇÁö ¾Ê½À´Ï´Ù.

°°Àº Çü½ÄÀÇ ¸ÞŸ-Á¤º¸°¡ ¸ÅÇÎµÈ ÇϳªÀÌ»óÀÇ È®ÀåÀÚ ¶ó¸é, ¿À¸¥ÂÊÀÇ °Í¸¸ »ç¿ëµË´Ï´Ù. ¿¡¸¦ µé¾î MIME-type image/gif ¿¡ ¸ÅÇÎµÈ ".gif"  ¿Í MIME-type text/html ¿¡ ¸ÅÇÎµÈ ".html" ÀÎ ÆÄÀÏ welcome.gif.html Àº MIME-type "text/html"·Î¸¸ ¿¬µ¿µÇ¾î Áý´Ï´Ù.

µÎ°³ ÀÌ»óÀÇ È®ÀåÀÚ¸¦ °¡Áø °æ¿ì MIMEÇü½Ä°ú Çڵ鷯 µÑ´Ù ¿¬µ¿ ½Ãų ¼ö ÀÖ½À´Ï´Ù. À̰ÍÀº º¸Åë Çڵ鷯¿Í ÇÔ²² ¿¬µ¿µÈ ¸ðµâ¿¡ ÀÇÇØ¼­ ½ÃÀÛµÈ ¿äûÀÇ °á°ú ÀÔ´Ï´Ù. ¿¹¸¦ µé¾î .imap extension Àº handler "imap-file" (from mod_imap) ¿¡ ¸ÅÇεǾî ÀÖ°í, .html extension Àº MIME-type "text/html" ¿¡ ¸ÅÇεǾî ÀÖ½À´Ï´Ù. À̰æ¿ì world.imap.html ´Â "imap-file" handler ¿Í "text/html" MIME-type µÎ°¡Áö¿¡ ´Ù ¿¬µ¿µË´Ï´Ù. ÇÁ·Î¼¼½º°¡ ½ÃÀ۵Ǹé "imap-file" handler ´Â »ç¿ëµÇ°í mod_imap imagemap file ·Î ó¸® µË´Ï´Ù.  

Directives


AddCharset

Syntax: AddCharset charset extension [extension...]
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime
Compatibility: AddCharset is only available in Apache 1.3.10 and later

The AddCharset directive ´Â ÁÖ¾îÁø ÆÄÀÏÀ̸§ È®ÀåÀÚ Æ¯Á¤ÇÑ ÄÁÅÙÃ÷ ¹®ÀÚ¼Â()À» ¸ÅÇÎÇÑ´Ù. charset Àº extension(È®ÀåÀÚ)¸¦ Æ÷ÇÔÇÏ´Â ÆÄÀÏÀ̸§ÀÇ MIME charset ¸Å°³º¯¼ö ÀÔ´Ï´Ù. ÀÌ ¸ÅÇÎÀº °°Àº extension(È®ÀåÀÚ) ¿¡ ´ëÇØ¼­ Ãß°¡ µÇ¾îÁý´Ï´Ù.

Example:

    AddLanguage ja .ja
    AddCharset EUC-JP .euc
    AddCharset ISO-2022-JP .jis
    AddCharset SHIFT_JIS .sjis

Then the document xxxx.ja.jis will be treated as being a Japanese document whose charset is ISO-2022-JP (as will the document xxxx.jis.ja). The AddCharset directive is useful for both to inform the client about the character encoding of the document so that the document can be interpreted and displayed appropriately, and for content negotiation, where the server returns one from several documents based on the client's charset preference.

See also: mod_negotiation


AddEncoding

Syntax: AddEncoding MIME-enc extension extension...
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime

»õ·Î¿î ŸÀÔÀÇ È®ÀåÀÚ¿¡ ´ëÇØ¼­ ÇÏÀ§ MIMEŸÀÔÀ» ÁöÁ¤ÇÑ´Ù. ±×¸®°í ÀÌ Å¸ÀÔÀÇ ¹®¼­¿¡ ´ëÇØ¼­´Â ºñÆ® EncodingÀ» ÇÔÀ» ÀǹÌÇÑ´Ù. Åë»ó ¹Ù·ÎµÚ¿¡ ¿£ÄÚµùÇÒ ¾ð¾îÁöÁ¤µð·ºÅÍ(AddLanguage)°¡ µÚ¿¡ µû¸¥´Ù.

The AddEncoding directive ´Â ÁÖ¾îÁø ÆÄÀÏÀ̸§ È®ÀåÀÚ¿¡ ÀÎÄÚµù Çü½ÄÀ» ¸ÅÇÎÇÑ´Ù. MIME-enc is´Â extension(È®ÀåÀÚ) ¸¦ ÆûÇÔÇÏ´Â ¹®¼­¿¡¼­ »ç¿ëÇÒ MIME encoding ÀÔ´Ï´Ù. to use for documents containing the . This mapping is added to any already in force, overriding any mappings that already exist for the same extension. Example:

AddEncoding x-gzip gz
AddEncoding x-compress Z

À§ÀÇ ¿¹´Â È®ÀåÀÚ°¡ gzŸÀÔÀÎ È­ÀÏÀ» gzip¹æ½ÄÀ¸·Î EncodingÇ϶ó´Â ÁöÁ¤ÀÌ´Ù. ¸¶Âù°¡Áö·Î È®ÀåÀÚ°¡ ZÀÎ È­ÀÏÀº compress¹æ½ÄÀ¸·Î EncodingÇ϶ó´Â ÁöÁ¤ÀÌ´Ù.

*ÁÖÀÇ: xÀÇ Àǹ̴ °ø½ÄÀûÀ¸·Î µî·ÏÀÌ µÇÁö ¾ÊÀº »ç¿ëÀÚ ÀÓÀÇÀÇ Å¸ÀÔÀ̱⠶§¹®ÀÌ´Ù. °ø½ÄÀûÀÎ µî·ÏÀº IANA¸¦ ÅëÇØ¼­¸¸ÀÌ µî·ÏÀÌ °¡´ÉÇϸç IETFÃøÀÇ ½ÉÀÇÀ§¿øµé°úÀÇ ½ÉÀǸ¦ ÅëÇØ¼­ °áÁ¤µË´Ï´Ù.

¶ÇÇÑ, ŸÀÔÁöÁ¤½Ã ´ë¼Ò¹®ÀÚ¸¦ È®½ÇÈ÷ ±¸º°ÇÑ´Ù´Â °ÍÀ» À¯ÀÇÇϱ⠹ٶø´Ï´Ù.

¡¡

Old clients expect x-gzip and x-compress, however the standard dictates that they're equivalent to gzip and compress respectively. Apache does content encoding comparisons by ignoring any leading x-. When responding with an encoding Apache will use whatever form (i.e., x-foo or foo) the client requested. If the client didn't specifically request a particular form Apache will use the form given by the AddEncoding directive. To make this long story short, you should always use x-gzip and x-compress for these two specific encodings. More recent encodings, such as deflate should be specified without the x-.

See also: Files with multiple extensions


AddHandler

Syntax: AddHandler handler-name extension extension...
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime
Compatibility: AddHandler is only available in Apache 1.1 and later

AddHandler maps the filename extensions extension to the handler handler-name. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. For example, to activate CGI scripts with the file extension ".cgi", you might use:

    AddHandler cgi-script cgi

Once that has been put into your srm.conf or httpd.conf file, any file containing the ".cgi" extension will be treated as a CGI program. À§ÀÇ ¿¹´Â È®ÀåÀÚ°¡ cgiÈ­ÀÏÀ» cgi-scriptÇÁ·Î±×·¥¿¡ ÀÇÇØ ó¸®Ç϶ó´Â ÁöÁ¤ÀÌ´Ù.

See also: Files with multiple extensions


AddLanguage

Syntax: AddLanguage MIME-lang extension extension...
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime

The AddLanguage directive maps the given filename extensions to the specified content language. MIME-lang is the MIME language of filenames containing extension. This mapping is added to any already in force, overriding any mappings that already exist for the same extension.

Example:

AddEncoding x-compress Z
AddLanguage en .en
AddLanguage fr .fr

Then the document xxxx.en.Z will be treated as being a compressed English document (as will the document xxxx.Z.en). Although the content language is reported to the client, the browser is unlikely to use this information. The AddLanguage directive is more useful for content negotiation, where the server returns one from several documents based on the client's language preference.

À§ÀÇ ¿¹¿¡¼­´Â È®ÀåÀÚ°¡ ZÀÎ ¾ÐÃàÈ­ÀÏ¿¡¼­ .enÀÌ Æ÷ÇԵȰÍÀº ¿µ¾î·Î EncodingÇϰí .fr·Î µÈ°ÍÀº ÇÁ¶û½º¾î·Î EncodingÇ϶ó´Â ÁöÁ¤ÀÌ´Ù.

*Âü°í: ¾ð¾îŸÀÔ¿¡ ´ëÇØ¼­´Â ¾ÆÆÄÄ¡¸Þ´º¾óÀ» Âü°íÇϱ⠹ٶõ´Ù. ¿ì¸®³ª¶ó´Â krÀÌ°í ¹Ì±¹Àº us,ÀϺ»Àº jpµîµîÀÌ´Ù.

¡¡

If multiple language assignments are made for the same extension, the last one encountered is the one that is used. That is, for the case of:

    AddLanguage en .en
    AddLanguage en-uk .en
    AddLanguage en-us .en

documents with the extension ".en" would be treated as being "en-us".

See also: Files with multiple extensions
See also: mod_negotiation


AddType

Syntax: AddType MIME-type extension extension...
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime

The AddType directive maps the given filename extensions onto the specified content type. MIME-enc is the MIME type to use for filenames containing extension. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. This directive can be used to add mappings not listed in the MIME types file (see the TypesConfig directive). Example:

AddType image/gif GIF
It is recommended that new MIME types be added using the AddType directive rather than changing the TypesConfig file.

Note that, unlike the NCSA httpd, this directive cannot be used to set the type of particular files.

À§ÀÇ ¿¹´Â È®ÀåÀÚ°¡ GIFÀÎ È­ÀÏÀ» image/gif·Î ÁöÁ¤ÇÑ´Ù´Â Àǹ̰¡ µÈ´Ù. ÀÌ·¸°Ô ÁöÁ¤ÇسõÀ¸¸é È®ÀåÀÚ°¡ GIFÀÎ ¹®¼­¸¦ Àü¼Û¹Þ´Â Ŭ¶óÀ̾ðÆ®(ºê¶ó¿ìÀú µîÀÇ ¼ÒÇÁÆ®¿þ¾î)´Â À§¿¡ ÁöÁ¤ÇÑ Å¸ÀÔÀÎ image/gif¸¦ ¸ÕÀú Àü¼Û¹Þ±â ¶§¹®¿¡ È­ÀÏÀÇ Á¾·ù¸¦ ¹Ì¸® ¾Ë¼ö ÀÖ°Ô µÈ´Ù. gifÈ­ÀÏÀ» º¸¿©ÁÖ´Â Ç÷¯±×ÀÎÀ» ¶ç¿ì´øÁö ºê¶ó¿ìÀú ³»ºÎ¿¡¼­ º¸¿©ÁÖµçÁö ´ëó¸¦ ÇÏ°Ô µÈ´Ù´Â °ÍÀÌ´Ù.

*Âü°í: »óÀ§ MIME-TYPEÀº Àü¿¡ Á¦½ÃÇÑ 7°³ÀÇ Å¸ÀÔÁß ÇѰ³°¡ µÇ¾î¾ß Çϸç, ÇÏÀ§ MIME-TYPEÀº ÀÓÀÇ·Î ¸¸µé¾îÁø ŸÀÔ¸íÀ» ÁöÁ¤ÇÏ¸é µÈ´Ù. (´Ü,Ŭ¶óÀÌ¾ðÆ®°¡ À§¿¡ ÁöÁ¤ÇÑ Å¸ÀÔ¿¡ ´ëÇØ ÀûÀýÈ÷ ´ëóÇϵµ·Ï ¼³Á¤ÀÌ µÇ¾î ÀÖÁö ¾Ê´Ù¸é µð½ºÅ©¿¡ ÀúÀåÇÒÁö ¾î¶² Çڵ鷯 ÇÁ·Î±×·¥¿¡°Ô ³Ñ±æÁö ¹¯°Ô µÉ°ÍÀÌ´Ù.) ±×¸®°í È®ÀåÀÚ´Â ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÑ´Ù.

See also: Files with multiple extensions


DefaultLanguage

Syntax: DefaultLanguage MIME-lang
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime
Compatibility: DefaultLanguage is only available in Apache 1.3.4 and later.

The DefaultLanguage directive tells Apache that all files in the directive's scope (e.g., all files covered by the current <Directory> container) that don't have an explicit language extension (such as .fr or .de as configured by AddLanguage) should be considered to be in the specified MIME-lang language. This allows entire directories to be marked as containing Dutch content, for instance, without having to rename each file. Note that unlike using extensions to specify languages, DefaultLanguage can only specify a single language.

If no DefaultLanguage directive is in force, and a file does not have any language extensions as configured by AddLanguage, then that file will be considered to have no language attribute.

See also: mod_negotiation
See also: Files with multiple extensions


ForceType

Syntax: ForceType media type
Context: directory, .htaccess
Status: Base
Module: mod_mime
Compatibility: ForceType is only available in Apache 1.1 and later.

When placed into an .htaccess file or a <Directory> or <Location> section, this directive forces all matching files to be served as the content type given by media type. For example, if you had a directory full of GIF files, but did not want to label them all with ".gif", you might want to use:

    ForceType image/gif

Note that this will override any filename extensions that might determine the media type.

image/gifŸÀÔÀÇ ¹®¼­µéÀº ŸÀÔÀü¼ÛÀÌ µÇÁö¾Ê´Â´Ù. ƯÁ¤ Á¾·ùÀÇ ¹®¼­¿¡ ´ëÇØ¼­ ¿­¶÷À» ÅëÁ¦ÇÒ ¼ö ÀÖ´Â ÁÁÀº ¹æ¹ýÀ¸·Î ¸¹ÀÌ ¾²ÀδÙ.

¡¡


RemoveHandler

Syntax: RemoveHandler extension extension...
Context: directory, .htaccess
Status: Base
Module: mod_mime
Compatibility: RemoveHandler is only available in Apache 1.3.4 and later.

The RemoveHandler directive removes any handler associations for files with the given extensions. This allows .htaccess files in subdirectories to undo any associations inherited from parent directories or the server config files. An example of its use might be:

/foo/.htaccess:
AddHandler server-parsed .html
/foo/bar/.htaccess:
RemoveHandler .html

This has the effect of returning .html files in the /foo/bar directory to being treated as normal files, rather than as candidates for parsing (see the mod_include module).


SetHandler

Syntax: SetHandler handler-name
Context: directory, .htaccess
Status: Base
Module: mod_mime
Compatibility: SetHandler is only available in Apache 1.1 and later.

When placed into an .htaccess file or a <Directory> or <Location> section, this directive forces all matching files to be parsed through the handler given by handler-name. For example, if you had a directory you wanted to be parsed entirely as imagemap rule files, regardless of extension, you might put the following into an .htaccess file in that directory:

    SetHandler imap-file

Another example: if you wanted to have the server display a status report whenever a URL of http://servername/status was called, you might put the following into access.conf:

    <Location /status>
    SetHandler server-status
    </Location>

À§ÀÇ ¿¹¿¡¼­ »ç¿ëÀÚ ¸ÞÀΠȨÆäÀÌÁö ÁÖ¼Ò´ÙÀ½¿¡ /status¸¦ ÀÔ·ÂÇϸé server-statusÇÁ·Î±×·¥ÀÌ ½ÇÇàµÇ¶ó´Â ÀǹÌÀÌ´Ù.


TypesConfig

Syntax: TypesConfig filename
Default: TypesConfig conf/MIME.types
Context: server config
Status: Base
Module: mod_mime

ÀÌ µð·ºÅÍ´Â ¿©·¯°³ÀÇ È®ÀåÀÚ¸¦ ÇϳªÀÇ MIME-TYPEÀ¸·Î ¹­¾îÁÖ´Â ¿ªÈ°À» ÇØÁØ´Ù. °¡·É text/html MIME-TYPEÀº À߾˷ÁÁø ŸÀÔÀÌ´Ù. htmlÈ­ÀÏÀº È®ÀåÀÚ°¡ htmÀϼöµµ ÀÖ°í htmlÀÏ ¼öµµ ÀÖ´Ù. ¶ÇÇÑ ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐÇϱ⠶§¹®¿¡ °°Àº ÀǹÌÀÏÁö¶óµµ ´ë¼Ò¹®ÀÚ¿¡ µû¶ó ¼­¹ö°¡ ÀνÄÇÒ¼öµµ ÀνÄÇÏÁö ¸øÇÒ¼öµµ ÀÖÀ» °ÍÀÌ´Ù. ±×·²¶§ »ç¿ëÇÏ´Â µð·ºÅͰ¡ À̰ÍÀÌ´Ù.

The TypesConfig directive sets the location of the MIME types configuration file. Filename is relative to the ServerRoot. This file sets the default list of mappings from filename extensions to content types; changing this file is not recommended. Use the AddType directive instead. The file contains lines in the format of the arguments to an AddType command:

MIME-type extension extension ...
The extensions are lower-cased. Blank lines, and lines beginning with a hash character (`#') are ignored.


Apache HTTP Server Version 1.3

Index Home