mod_dir - Apache HTTP Server Version 2.4

Apache Server 2.4

<-

아파치 모듈 mod_dir

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

요약

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

  • 사용자가 작성한 보통 index.html이라는 파일. DirectoryIndex 지시어는 이 파일의 이름을 지정한다. mod_dir가 이 지시어를 제공한다.
  • 아니라면 서버가 만든 목록. mod_autoindex가 이 기능을 제공한다.

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

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

top

DirectoryCheckHandler 지시어

설명:Toggle how this module responds when another handler is configured
문법:DirectoryCheckHandler On|Off
기본값:DirectoryCheckHandler Off
사용장소:주서버설정, 가상호스트, directory, .htaccess
Override 옵션:Indexes
상태:Base
모듈:mod_dir
지원:Available in 2.4.8 and later. Releases prior to 2.4 implicitly act as if "DirectoryCheckHandler ON" was specified.

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

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

DirectoryIndexRedirect 지시어

설명:Configures an external redirect for directory indexes.
문법:DirectoryIndexRedirect on | off | permanent | temp | seeother | 3xx-code
기본값:DirectoryIndexRedirect off
사용장소:주서버설정, 가상호스트, directory, .htaccess
Override 옵션:Indexes
상태:Base
모듈:mod_dir
지원:Available in version 2.3.14 and later

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

top

DirectorySlash 지시어

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

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

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

  • 사용자는 결국 자원의 정규 URL을 요청하게 된다
  • mod_autoindex가 올바로 동작한다. 이 기능이 없다면 이 모듈은 링크에 잘못된 경로를 쓰게 된다.
  • DirectoryIndex는 마지막 슬래쉬가 있는 디렉토리 요청만을 처리한다.
  • html 페이지에 있는 상대적인 URL 참조가 올바로 동작한다.

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

# 아래 보안 경고 참고!
<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
문법:
사용장소:주서버설정, 가상호스트, directory, .htaccess
상태:Base
모듈:mod_dir

Documentation not yet translated. Please see English version of document.