mod_mime.c
ÈÀÏ¿¡ °ü·ÃÄڵ尡
Æ÷ÇԵǾî ÀÖ´Ù.
¼±¾ð 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½¬µÈ
º¹»çº»Àº ¿©ÀüÈ÷ ±âÁ¸ÀÇ Çì´õ¸¦ °¡Áö°í Ŭ¶óÀÌ¾ðÆ®³ª
ÇÁ¶ô½Ã¿¡ ÀÇÇØ¼ »ç¿ëµÇ°í ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù.
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 ·Î ó¸® µË´Ï´Ù.
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
»õ·Î¿î ŸÀÔÀÇ È®ÀåÀÚ¿¡ ´ëÇØ¼ ÇÏÀ§ 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 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
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
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
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
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ŸÀÔÀÇ ¹®¼µéÀº ŸÀÔÀü¼ÛÀÌ µÇÁö¾Ê´Â´Ù. ƯÁ¤ Á¾·ùÀÇ ¹®¼¿¡ ´ëÇØ¼ ¿¶÷À» ÅëÁ¦ÇÒ ¼ö ÀÖ´Â ÁÁÀº ¹æ¹ýÀ¸·Î ¸¹ÀÌ ¾²ÀδÙ.
¡¡
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).
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 conf/MIME.types
ÀÌ µð·ºÅÍ´Â ¿©·¯°³ÀÇ È®ÀåÀÚ¸¦ ÇϳªÀÇ 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.