<-
Apache > HTTP Server > Documentation > Version 2.2 > 모듈

Please note

This document refers to a legacy release (2.2) of Apache httpd. The active release (2.4) is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

아파치 모듈 mod_dir

가능한 언어:  en  |  ja  |  ko  |  tr 

이 문서는 최신판 번역이 아닙니다. 최근에 변경된 내용은 영어 문서를 참고하세요.
설명:"마지막 슬래쉬" 리다이렉션을 제공하고 디렉토리 index 파일을 서비스한다
상태:Base
모듈명:dir_module
소스파일:mod_dir.c

요약

디렉토리의 index는 다음 둘중 한가지 방법으로 제공된다:

두 기능은 서로 별개로 원한다면 자동 index 생성을 완전히 없앨 (혹은 교체할) 수 있다.

dirname이 디렉토리라면 서버는 URL http://servername/foo/dirname 요청을 받으면 "마지막 슬래쉬" 리다이렉션을 보낸다. 디렉토리에는 마지막 슬래쉬가 필요하다. 그래서 mod_dirhttp://servername/foo/dirname/로 리다이렉션을 보낸다.

지시어들

top

DirectoryIndex 지시어

설명:클라이언트가 디렉토리를 요청할때 찾아볼 자원 목록
문법:DirectoryIndex local-url [local-url] ...
기본값:DirectoryIndex index.html
사용장소:주서버설정, 가상호스트, directory, .htaccess
Override 옵션:Indexes
상태:Base
모듈:mod_dir

DirectoryIndex 지시어는 클라이언트가 디렉토리명 끝에 /를 붙여서 디렉토리의 index를 요청할때 찾아볼 자원 목록을 지정한다. Local-url은 요청한 디렉토리에 상대적인 문서의 (%로 인코딩된) URL이다. 보통은 디렉토리에 있는 파일명이다. 여러 URL을 지정할 수 있고, 이 경우 서버는 첫번째로 찾은 파일을 보낸다. 자원을 찾을 수 없고 Indexes 옵션을 설정하였다면 서버는 직접 디렉토리 목록을 만든다.

예제

DirectoryIndex index.html

이 경우 http://myserver/docs/를 요청할때 http://myserver/docs/index.html이 있으면 이를 보내고, 없다면 디렉토리 목록을 보낸다.

문서가 반드시 디렉토리에 상대적일 필요는 없다.

DirectoryIndex index.html index.txt /cgi-bin/index.pl

이 경우 디렉토리에 index.html이나 index.txt가 없으면 CGI 스크립트 /cgi-bin/index.pl을 실행한다.

top

DirectorySlash 지시어

설명:마지막 슬래쉬 리다이렉션을 키고 끈다
문법:DirectorySlash On|Off
기본값:DirectorySlash On
사용장소:주서버설정, 가상호스트, directory, .htaccess
Override 옵션:Indexes
상태:Base
모듈:mod_dir
지원:아파치 2.0.51 이후부터

DirectorySlash 지시어는 mod_dir가 디렉토리를 가리키는 URL을 수정할지 여부를 결정한다.

사용자가 마지막 슬래쉬없이 디렉토리에 해당하는 자원을 요청하면, mod_dir는 보통 다음과 같은 이유로 사용자를 마지막 슬래쉬를 붙인 동일한 자원으로 리다이렉션한다.

그런데 이 기능을 원하지 않거 위에 든 이유가 당신에게 알맞지 않다면 다음과 같이 리다이렉션을 하지 않을 수 있다.

# 아래 보안 경고 참고!
<Location /some/path>
DirectorySlash Off
SetHandler some-handler
</Location>

보안 경고

마지막 슬래쉬 리다이렉션을 끄면 정보가 유출될 수 있다. (Options +Indexes) mod_autoindex를 사용하고 DirectoryIndex를 (index.html 같은) 유효한 자원으로 설정하였지만 해당 URL에 다른 특별한 핸들러가 없는 상황을 상상해보라. 이 경우 마지막 슬래쉬가 있는 요청은 index.html 파일을 보여준다. 그러나 마지막 슬래쉬가 없는 요청은 디렉토리 내용을 보여준다.

top

FallbackResource 지시어

설명:Define a default URL for requests that don't map to a file
문법:FallbackResource disabled | local-url
기본값:None - httpd will return 404 (Not Found)
사용장소:주서버설정, 가상호스트, directory, .htaccess
Override 옵션:Indexes
상태:Base
모듈:mod_dir
지원:Apache HTTP Server 2.2.16 and later - The disabled argument is supported since 2.2.24

The documentation for this directive has not been translated yet. Please have a look at the English version.

가능한 언어:  en  |  ja  |  ko  |  tr 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.
Comments are disabled for this page at the moment.