작은숲:위키노트/아파치: 두 판 사이의 차이

큰숲백과, 나무를 보지 말고 큰 숲을 보라.
잔글 (문자열 찾아 바꾸기 - "<references/>" 문자열을 "{{각주}}" 문자열로)
잔글 (Utolee90님이 위키노트:아파치 문서를 넘겨주기를 만들지 않고 작은숲:위키노트/아파치 문서로 이동했습니다: 위키노트 문서 작은숲으로 이동)
 
(같은 사용자의 중간 판 7개는 보이지 않습니다)
3번째 줄: 3번째 줄:
=== Apache에서 사용자 인증 방식 사용 ===
=== Apache에서 사용자 인증 방식 사용 ===
==== 사용자 추가 ====
==== 사용자 추가 ====
<source lang="console">
<syntaxhighlight lang="console">
$ htpasswd -c /usr/local/apache/passwd/passwords someone
$ htpasswd -c /usr/local/apache/passwd/passwords someone
</source>
</syntaxhighlight>
==== Apache 설정 ====
==== Apache 설정 ====
<source lang="apache">
<syntaxhighlight lang="apache">
AuthType Basic
AuthType Basic
AuthName "Restricted Files"
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
AuthUserFile /usr/local/apache/passwd/passwords
Require user someone
Require user someone
</source>
</syntaxhighlight>
==== 참고 ====
==== 참고 ====
* http://httpd.apache.org/docs-2.0/ko/howto/auth.html
* http://httpd.apache.org/docs-2.0/ko/howto/auth.html
== 아파치 서버 설정 ==
== 아파치 서버 설정 ==
=== 그림 파일 등의 외부 링크 금지 ===
=== 그림 파일 등의 외부 링크 금지 ===
<source lang="apache">
<syntaxhighlight lang="apache">
# for link reject
# for link reject
SetEnvIf Referer "http://(www\.)?mooo.org" link_allow
SetEnvIf Referer "http://(www\.)?mooo.org" link_allow
32번째 줄: 32번째 줄:
#ErrorDocument 403 "Cannot Link Image Files"
#ErrorDocument 403 "Cannot Link Image Files"
#</FilesMatch>
#</FilesMatch>
</source>
</syntaxhighlight>
=== 디렉토리 설정 ===
=== 디렉토리 설정 ===
<source lang="apache">
<syntaxhighlight lang="apache">
<Directory "/home/httpd/html">
<Directory "/home/httpd/html">
Options FollowSymLinks
Options FollowSymLinks
43번째 줄: 43번째 줄:
Deny from env=no_access
Deny from env=no_access
</Directory>
</Directory>
</source>
</syntaxhighlight>
# <tt>Options</tt> – 해당 디렉토리의 기본 설정. 아래 설정들을 조합할 수 있다.
# <tt>Options</tt> – 해당 디렉토리의 기본 설정. 아래 설정들을 조합할 수 있다.
#* <tt>None</tt> – 어떤 옵션도 이용할 수 없다.
#* <tt>None</tt> – 어떤 옵션도 이용할 수 없다.
71번째 줄: 71번째 줄:
* http://oops.org/?t=lecture&sb=apache&n=2
* http://oops.org/?t=lecture&sb=apache&n=2
=== 특정 Agent 접속 거부 등 ===
=== 특정 Agent 접속 거부 등 ===
<source lang="apache">
<syntaxhighlight lang="apache">
  # 특정 Agent 접근 거부
  # 특정 Agent 접근 거부
BrowserMatch "WebZIP" no_access
BrowserMatch "WebZIP" no_access
114번째 줄: 114번째 줄:
Deny from env=no_access
Deny from env=no_access
</Directory>
</Directory>
</source>
</syntaxhighlight>
== 같이 보기 ==
== 같이 보기 ==
* [[위키노트:아파치 Rewrite 모듈]]
* [[작은숲:위키노트/아파치 Rewrite 모듈]]
* [[위키노트:아파치 설정]]
* [[작은숲:위키노트/아파치 설정]]
* [[위키노트:아파치 사용자 인증]]
* [[작은숲:위키노트/아파치 사용자 인증]]
== 참고 ==
== 참고 ==
* http://geist.co.kr/stories.php?story=03/03/30/3913054
* http://geist.co.kr/stories.php?story=03/03/30/3913054
128번째 줄: 128번째 줄:
{{아파치}}
{{아파치}}
{{리눅스}}
{{리눅스}}
[[분류:공유]]
[[분류:위키노트/공유]]
[[분류:웹]]
[[분류:위키노트/웹]]
[[분류:서버]]
[[분류:위키노트/서버]]
[[분류:소프트웨어 설정]]{{퍼온문서|위키노트|{{#invoke:string|replace|{{PAGENAME}}|위키노트:|}}}}[[분류:위키노트에서 가져온 문서]]
[[분류:위키노트/소프트웨어 설정]]{{퍼온문서|위키노트|{{#invoke:string|replace|{{PAGENAME}}|위키노트:|}}}}[[분류:위키노트에서 가져온 문서]]

2022년 5월 7일 (토) 19:22 기준 최신판

아파치 HTTP 서버(Apache HTTP Server)는 아파치 소프트웨어 재단에서 관리하는 HTTP 서버이다. 범용 운영체제의 대부분을 지원한다.[1]

아파치 서버 활용

Apache에서 사용자 인증 방식 사용

사용자 추가

$ htpasswd -c /usr/local/apache/passwd/passwords someone

Apache 설정

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user someone

참고

아파치 서버 설정

그림 파일 등의 외부 링크 금지

# for link reject
SetEnvIf Referer "http://(www\.)?mooo.org" link_allow
#SetEnvIf Referer ^$ link_allow
<Directory /home/httpd/data>
order deny,allow
deny from all
allow from env=link_allow
</Directory>
#<FilesMatch ".(gif|bmp|jpe?g|png|GIF|BMP|JPE?G|PNG)$">
#order deny,allow
#deny from all
#allow from env=link_allow
#ErrorDocument 403 "Cannot Link Image Files"
#</FilesMatch>

디렉토리 설정

<Directory "/home/httpd/html">
Options FollowSymLinks
AllowOverride None
# 서버로부터 자료를 얻어갈 수 있는 위치를 제어한다.
Order allow,deny
Allow from all
Deny from env=no_access
</Directory>
  1. Options – 해당 디렉토리의 기본 설정. 아래 설정들을 조합할 수 있다.
    • None – 어떤 옵션도 이용할 수 없다.
    • All – 지정한 디렉토리에서 모든 명령을 이용할 수 있다.
    • Indexes – URL에 지정된 디렉토리에 (index.html 같은) 지정된 파일이 없을 경우 디렉토리의 파일 목록을 보여주는 옵션.
    • Includes – 서버측의 추가적인 정보를 제공할 수 있게 한다.
    • IncludesNoExec – 서버측의 추가적인 정보를 제공할 수 있게 하지만, 어떠한 실행 파일을 실행하는 것을 방지한다.
    • FollowSymLinks – 디렉토리 상의 심볼릭 링크를 사용가능하게 한다.
    • ExecCGI – CGI 스크립트를 실행할 수 있게 한다.
    • MultiViewsAll 옵션이 설정되었을 때만 지정된 목록의 multiviews를 허용한다.
  2. AllowOverride.htaccess 파일은 서버의 각 디렉토리에 만들어서 각 디렉토리에 대한 접근을 제어하기 위한 것으로 디렉토리에 .htaccess 파일이 있으면, 서버 전체에 작용하는 설정보다 우선권을 가진다. .htaccess 파일에 대한 Override에 대한 옵션이다. 가능한 옵션은 다음과 같다.
    • None.htaccess 파일을 읽을 수 없게 한다.
    • All – 모든 지정에 대해 가능하게 한다.
    • Options – 규정된 디렉토리 형식을 콘트롤하는 지정의 사용을 허락한다.
    • FileInfo – 문서 형식을 제어하는 설정의 사용을 허용한다.
    • AuthConfig – 사용자 인증 설정의 사용을 허용한다. 사용자 인증 변수를 사용한다.
    • Limit – 호스트 접근을 제어하는 설정을 허용한다.
  3. Limit에 관련된 부분을 설정을 한다.
    • order – 서버가 접근 제어(access control)를 수행하는 순서를 나타낸다. 여기서는 allow 기능을 먼저 수행하고, deny 기능을 수행하라는 것이다.
      • deny, allowdeny 지시자 부터 검사하고 allow 지시자를 검사
      • allow, denyallow 지시자 부터 검사하고 deny 지시자를 검사
      • mutual-failureallow 목록에 없는 모든 호스트에게 접속을 거부
    • allow from – 나열되는 주소들에 대한 접근 제어를 가능하게 한다. 사용 가능한 주소는 도메인 네임, 호스트 이름 주소, 호스트 IP 주소, IP 주소의 앞부분 3바이트, 모든 주소에 해당하는 all이 있다.
    • deny fromallow from과 반대되는 개념이며, 사용가능한 주소는 allow from과 같다.
    • require – 사용자, 그룹에 대한 접근을 통제할 수 있다.

참고

특정 Agent 접속 거부 등

 # 특정 Agent 접근 거부
BrowserMatch "WebZIP" no_access
BrowserMatch "Teleport" no_access
BrowserMatch "GetRight" no_access
BrowserMatch "FlashGet" no_access
BrowserMatch "JetCar" no_access
BrowserMatch "Go!Zilla" no_access
BrowserMatch "Namo" no_access
BrowserMatch "FrontPage" no_access
BrowserMatch "WebTrack-HTTPP" no_access
BrowserMatch "WebSymmetrix" no_access
# 로컬 호스트 접속일 때 로그 남기지 않음
SetEnvIf Remote_Addr "^127.0.0.1$" not_log
# 이미지 파일 자바스크립트 파일 등 남기지 않음.
SetEnvIfNoCase Request_URI "\.(bmp|gif|jpg|jpeg|png|css|js|java)$" not_log
# 엔진 로봇 로그를 남기 않음
BrowserMatchNoCase "ru-robot" not_log a_robot
BrowserMatchNoCase "Slurp/si" not_log a_robot
BrowserMatchNoCase "Mercator" not_log a_robot
BrowserMatchNoCase "Gulliver" not_log a_robot
BrowserMatchNoCase "SyncIT/" not_log a_robot
BrowserMatchNoCase "FAST-WebCrawler" not_log a_robot
BrowserMatchNoCase "Lycos_Spider" not_log a_robot
BrowserMatchNoCase "^ia_archive" not_log a_robot
BrowserMatchNoCase "^tv" not_log a_robot
BrowserMatchNoCase "Scooter" not_log a_robot
BrowserMatchNoCase "ZyBorg/" not_log a_robot
BrowserMatchNoCase "KIT-Fireball" not_log a_robot
BrowserMatchNoCase "Googlebot/" not_log a_robot
BrowserMatchNoCase "DIIbot/" not_log a_robot
BrowserMatchNoCase "teoma_agent3" not_log a_robot
BrowserMatchNoCase "empas_robot" not_log a_robot
BrowserMatchNoCase "empas" no_access
# 로그 남기기
CustomLog /usr/local/apache/logs/access_log combined env=!not_log
<Directory /home/>
Options Indexes FollowSymLinks Includes
AllowOverride None
Order allow,deny
Allow from all
Deny from env=no_access
</Directory>

같이 보기

참고

각주

각주

틀:아파치

이 작은숲 문서의 출처는 위키노트의 위키노트/아파치 문서입니다.