'apache httpd.conf'에 해당되는 글 2건

  1. 2012.03.19 apache conf (httpd.conf)
  2. 2012.01.16 Apache conf 파일 분석 ( 2.2.x 이하 apache )
Web/Apache2012. 3. 19. 23:17


아래의 내용은 apache conf 파일인 httpd.conf 파일의 내용입니다. 버전별로 httpd.conf 의 내용 차이가 있지만
 큰 틀은 벗어나지 않습니다.

예를 들면 2.2.20 버전의 경우 apache설치위치/conf/extra/   에 각 설정 파일들이 나뉘어져 있고, httpd.conf 파일에서
주석처리가 되어있습니다. 주석처리를 해제하고 extra 에 있는 파일들을 수정하여 사용하여도 되고 extra 에 있는
해당 내용들은 httpd.conf 에 그대로 입력하거나 필요한 옵션들만 추가하여도 전혀 문제가 없습니다.
필요한 파일이나 참조할 설정파일이 있다면 httpd.conf 에서 Include 해주면 되니깐요. ^^

물론 항상 작업 전에는 httpd.conf 는 백업을 해놓는 것을 잊지 마세요.!
또한 작업후 apache 재시작 하기전apache설치위치/bin/apachectl configtest 또는 apache설치위치/bin/httpd -t 로 구문에 오류가 없는지 확인은 필수 입니다.

아래의 내용들은 제가 2.0.X 시절 httpd.conf 파일의 내용에서 각 항목들에 주석을 달아놓은 문서입니다.
요즘은 2.2.20 이상은 주로 씁니다.. 상위버전도 나왔구요. 그래도 아쉬운 마음에 올리니 참고하시기 바랍니다.
(혹 잘못된 내용이나 문제가 있으면 댓글을 부탁드립니다..ㅡㅜ)

자 내용을 보려면 아래의 펼치기 버튼을 클릭하세요.^^




'Web > Apache' 카테고리의 다른 글

Apache2 MPM prefork & worker  (0) 2013.11.25
Apache 메모리 누수  (0) 2012.09.05
Apache - mod_jk2 설치 중 configure: error: can't locate libapr 에러  (0) 2012.07.26
apache configure 옵션  (0) 2012.03.19
Posted by 소울하트
시스템/Linux2012. 1. 16. 17:30

# This is the main Apache server configuration file.

크게 3 섹션으로 나누어져 있습니다.

1. 아파치 서버 프로세스 전체의 운영에 직접적으로 제어할 수 있는 부분

2. 메인이나 디폴트 서버에 관한 설정을 관리하는 부분

3. 가상 호스트에 대한 설정을 관리하는 부분

### Section 1: Global Environment

전반적인 아파치 운영에 관한 설정을 합니다.

# ServerRoot: 최상의 디렉토리. 서버의 설정, 에러, 로그 파일들이 담겨져있습니다.

ServerRoot "/etc/httpd"

# PidFile: 서버가 시작할 때 프로세스 식별 번호(PID)를 담는 파일.

PidFile run/httpd.pid

# Timeout: 클라이언트와 연결이 되었을 때 송수신을 하지 않아 타임아웃으로 처리하는 시간

Timeout 120

# KeepAlive: 접속한 채로 아무 반응이 없을 경우 지속적인 연결을 허용할지 안할지 설정

KeepAlive Off

# MaxKeepAliveRequests: 지속적인 연결 동안에 서버에게 요청할 수 있는 최대의 수

0이면 무제한. 크면 클수록 최대의 성능을 발휘

MaxKeepAliveRequests 100

# KeepAliveTimeout: 같은 클라이언트의 같은 연결 상태에서 몇 초 동안 다음 요청을 기다릴 것인지 설정

KeepAliveTimeout 15

# Listen: 디폴트 이외에 특별한 IP또는 포트에 대해서도 연결 할 수 있도록 허용합니다.

<VirtualHost>부분에서 설정되는 가상호스트를 설정하기 위해서 필요합니다.

#Listen 12.34.56.78:80

Listen 80

# 아래의 디렉토리로부터 설정을 불러옵니다.

Include conf.d/*.conf

# server-status로 서버의 상태를 볼 때 full로 볼 것인지 기본만 볼 것인지 설정합니다.

#ExtendedStatus On

# 만약에 httpd를 특별한 다른 유저나 그룹에서 사용하기를 원한다면 먼저 root로 httpd를 초기화 하고 사용해야합니다.

User apache

Group apache

## Section 2: 'Main' server configuration

메인 서버가 사용하는 값을 설정합니다.

<VirtualHost>에서 설정하지 않은 것은 여기서 지정된 기본값으로 적용됩니다.

또한 여기서 지정한 값을 <VirtualHost>내에서도 지정할 수 있으며 이 경우엔 각 <VirtualHost>내에서 지정한 값이 우선 설정됩니다.

# ServerAdmin: 문제가 생겼을지 보내질 메일 주소를 설정합니다.

ServerAdmin root@localhost

# 클라이언트에게 보여주는 호스트 이름을 지정합니다. DNS name이 유효하지 않아도 호스트에서는 사용하는 것처럼 보이게 합니다. 호스트가 DNS name을 등록하지 않았다면 그 IP주소를 여기에 입력합니다. 어떻게든 이 주소로 접근이 가능할 것입니다.

#ServerName www.example.com:80

# UseCanonicalName: URL과 SERVER_NAME과 SERVER_PORT 변수가 어떻게 아파치가 참조할지 결정합니다. off를 하면 Hostname과 Port를 클라이언트에게 제공합니다. On으로 설정하면 아파치는 ServerName 값을 직접적으로 사용합니다.

UseCanonicalName Off

# DocumentRoot: 제공할 웹문서가 어느 곳에 위치할지 디렉토리를 설정합니다. 그러나 심볼릭 링크와 aliases는 다른 지점을 가리킬 수 있습니다.

DocumentRoot "/var/www/html"

<Directory />

Options FollowSymLinks

AllowOverride None

</Directory>

# 원하고 싶은 디렉토리로 바꾸면 됩니다.

<Directory "/var/www/html">

Options Indexes FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

</Directory>

# UserDir: 하나의 웹서버에 여러 사용자의 홈페이지를 관리할 때 필요한 개별 가입자의 홈페이지 디렉토리를 설정합니다.

경로의 마지막에는 웹서버의 userid가 접근할 수 있는 ‘public_html' 디렉토리가 반드시 있어야 합니다. 이는 보통 ~userid의 711 권한과 ~userid/public_html의 755권한을 의미하고 문서는 누구나 읽을 수 있어야 합니다. 반면에 클라이언트는 "403 Forbidden" 메시지를 받습니다.

<IfModule mod_userdir.c>

#

# 기본적으로 UserDIr은 허용하기 전까지 사용불가입니다.

#

UserDir disable

#"UserDir disable" line를 삭제하고 아래의 주석을 제거함으로써 사용이 가능해집니다.

#

#UserDir public_html

</IfModule>

# UserDir 디렉토리에 접근하도록 설정합니다. 아래는 예시입니다. 이 사이트는 읽기전용 제한이 있습니다.

#

#<Directory /home/*/public_html>

# AllowOverride FileInfo AuthConfig Limit

# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

# <Limit GET POST OPTIONS>

# Order allow,deny

# Allow from all

# </Limit>

# <LimitExcept GET POST OPTIONS>

# Order deny,allow

# Deny from all

# </LimitExcept>

#</Directory>

# DirectoryIndex: 디렉토리만을 지정했을 때 서버가 제공하는 파일을 설정합니다.

# 여러개를 설정할 수 있으나 많으면 많을수록 느려집니다.

DirectoryIndex index.html index.html.var

# AccessFileName: 디렉토리 별로 접근 제어할 정보를 담고 있는 파일을 지정합니다.

디렉토리 별로 인증을 거쳐서 접근할 수 있는 설정을 하기 위한 것입니다.

AccessFileName .htaccess

# 아래는 웹 클라이언트가 .htaccess와 .htpasswd 파일을 볼 수 없도록 막아 놓은 설정입니다.

<Files ~ "^\.ht">

Order allow,deny

Deny from all

</Files>

# mime.types을 설정한 파일을 지정합니다.

TypesConfig /etc/mime.types

# DefaultType는 기본적인 MIME 타입에 정의 되어 있지 않은 파일 형식에 대한 요청을 받았을 때 알 수 없는 문서 타입에 대하여 사용할 기본적인 타입을 설정합니다.

DefaultType text/plain

# mod_mime_magic module은 서버가 파일의 컨텐츠를 각각의 타입을 결정하는데 다양한 힌트를 줍니다. MIMEMagicFile은 모듈이 어디에 힌트 정의가 위치해있는지 알려줍니다.

<IfModule mod_mime_magic.c>

# MIMEMagicFile /usr/share/magic.mime

MIMEMagicFile conf/magic

</IfModule>

# HostnameLookups: 웹서버의 로그를 지정하는 Format에서 “DNS Lookup"으로 지정하였을 때, domain으로 남길 것인가 IP 주소를 남길 것인가를 지정합니다. 디폴트 off는 IP 주소로 남기는 것이며, Domainm로 변경할 필요가 없으므로 on으로 설정한 것보다는 속도가 좀 더 빠르다 on으로 하게 되면 IP주소를 IP domainm로 변환해야 하므로 속도가 조금 느릴 수 있다.

HostnameLookups Off

# EnableMMAP: 파일 전송을 memory-mapping을 사용할 것인지 아닌지를 설정합니다.

# 디폴트는 on. NFS-mounted 파일 시스템을 사용할 경우 off를 하십시오. 몇몇 시스템에서 off를 사용하면 성능 향상이 됩니다.

#

#EnableMMAP off

# EnableSendfile: 커널이 파일 전달에 도움을 줄지 안 줄지 설정합니다.

#

#EnableSendfile off

# ErrorLog: 에러 로그 파일의 위치를 지정합니다.The location of the error log file.

# If you do not specify an ErrorLog directive within a 참고로, <VirtualHost>에서 에러로그를 지정하지 않으면 가상호스트의 로그도 이곳에 저장하게 됩니다..

ErrorLog logs/error_log

# LogLevel: 위에 설정한 로그파일의 얼마나 자세히 적을지 메시지 수를 설정합니다.

# 중요도 순서는: debug, info, notice, warn, error, crit, alert, emerg.입니다.

LogLevel warn

# 로그 메시지 형식을 설정합니다.

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

#

# "combinedio" 몇 바이트를 받았는지 보냈는지 현재 카운트가 담겨져있습니다.

#

#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

#

# access logfile의 포맷과 위치를 설정합니다.

# <VirtualHost>의 access logfile을 설정하지 않으면 이곳에 로그들이 저장됩니다.

#

#CustomLog logs/access_log common

#

# agent와 referer의 로그 파일들을 나누기를 원한다면 아래와 같이 설정합니다.

#

#CustomLog logs/referer_log referer

#CustomLog logs/agent_log agent

#

# 하나의 로그파일로 접근하려면 아래와 같이 설정합니다.

#

CustomLog logs/access_log combined

#

# 서버가 생성하는 문서 (internal error documents, FTP directory listings, mod_status and mod_info output etc., but not CGI generated documents or custom error documents)의 trailing footer line 설정을 가능하게 합니다.

#

ServerSignature On

#

# Aliases: 필요한 만큼의 aliases를 추가할 수 있습니다.

# 형식 : Alias fakename realname

#

Alias /icons/ "/var/www/icons/"

<Directory "/var/www/icons">

Options Indexes MultiViews FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

</Directory>

#

# WebDAV module configuration section.

#

<IfModule mod_dav_fs.c>

# Location of the WebDAV lock database.

DAVLockDB /var/lib/dav/lockdb

</IfModule>

#

# ScriptAlias: 서버 스크립트 디렉토리를 설정합니다.

# 기본적으로 ScriptAliases는 Aiases와 같습니다. 예외적인 것이 실제 디렉토리 안에 들어있는 문서를 서버에 의해 응용프로그램으로 취급되어 실행되는 것입니다.

#

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

#

# ScriptAliased를 "/var/www/cgi-bin"로 바꾸고 싶다면 아래와 같이 합니다.

#

<Directory "/var/www/cgi-bin">

AllowOverride None

Options None

Order allow,deny

Allow from all

</Directory>

#

# IndexOptions: 디렉토리 리스트가 나타나는 옵션을 설정합니다.

#

IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

# 아래에서 지정하는 AddIcon* 설정은 위에서 설정한 디렉토리 인덱싱 옵션을FancyIndexingm로 한 경우에 해당하며 디렉토리 목록을 표시할 때 각 파일 확장자에 따라서 어떤 아이콘을 선택하여 보여줄 것인지를 지정합니다.

#

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*

AddIconByType (IMG,/icons/image2.gif) image/*

AddIconByType (SND,/icons/sound2.gif) audio/*

AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe

AddIcon /icons/binhex.gif .hqx

AddIcon /icons/tar.gif .tar

AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip

AddIcon /icons/a.gif .ps .ai .eps

AddIcon /icons/layout.gif .html .shtml .htm .pdf

AddIcon /icons/text.gif .txt

AddIcon /icons/c.gif .c

AddIcon /icons/p.gif .pl .py

AddIcon /icons/f.gif .for

AddIcon /icons/dvi.gif .dvi

AddIcon /icons/uuencoded.gif .uu

AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

AddIcon /icons/tex.gif .tex

AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..

AddIcon /icons/hand.right.gif README

AddIcon /icons/folder.gif ^^DIRECTORY^^

AddIcon /icons/blank.gif ^^BLANKICON^^

#

# DefaultIcon은 위에서 지정한 확장자가 아닌 경우에 여기서 설정한 기본 아이콘을 보여줍니다.

#

DefaultIcon /icons/unknown.gif

#

# AddDescription은 서버가 생성한 인덱스 파일 뒤에 간단한 설명을 나타낼 때 사용합니다. 이 설정은 FancyIndexing 으로 설정 되어있을 때만 표시 되며 설정 형식은 다음과 같습니다.

# 형식: AddDescription "description" filename

#

#AddDescription "GZIP compressed document" .gz

#AddDescription "tar archive" .tar

#AddDescription "GZIP compressed tar archive" .tgz

#

# ReadmeName 디렉토리 목록표시 뒤에 이어서 보여줄 파일의 이름을 지정합니다.

# HeaderName 디렉토리 목록표시 앞에서 보여줄 파일의 이름을 지정합니다.

#

ReadmeName README.html

HeaderName HEADER.html

#

# IndexIgnore은 디렉토리 인덱싱시 무시할 파일이름의 묶음 설정합니다.

Shell-style의 와일드 카드가 허용됩니다.

#

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

# DefaultLanguage와 AddLanguage에 문서의 언어를 특별하게 지정하도록 허락하게 합니다. default language를 지정하는 경우에 모든 데이터가 보이지 않을 수 있고 원하지 않는 결과를 얻을 수 있습니다.

# DefaultLanguage nl

# 게다가 사용이 모호한 점이 있습니다. 3가지. 그렇기 때문에 AddLanguage를 사용합니다.

AddLanguage ca .ca

AddLanguage cs .cz .cs

AddLanguage da .dk

AddLanguage de .de

AddLanguage el .el

AddLanguage en .en

AddLanguage eo .eo

AddLanguage es .es

AddLanguage et .et

AddLanguage fr .fr

AddLanguage he .he

AddLanguage hr .hr

AddLanguage it .it

AddLanguage ja .ja

AddLanguage ko .ko

AddLanguage ltz .ltz

AddLanguage nl .nl

AddLanguage nn .nn

AddLanguage no .no

AddLanguage pl .po

AddLanguage pt .pt

AddLanguage pt-BR .pt-br

AddLanguage ru .ru

AddLanguage sv .sv

AddLanguage zh-CN .zh-cn

AddLanguage zh-TW .zh-tw

#

# 언어의 순위는 컨텐츠의 경우에 따라 설정할 수 있습니다.

# 아래는 단순히 알파벳 순서입니다. 언제든지 원한다면 바꾸실 수 있습니다..

#

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

#

# 기본 charset를 설정합니다.

#

AddDefaultCharset UTF-8

#

# MIME 파일 설정을 특별한 파일 타입으로 추가할 수 있습니다.

#

#AddType application/x-tar .tgz

#

# 브라우져에 특별한 인코딩 방식을 추가합니다. 모든 브라우져가 지원하는 것이 아닙니다. #

#AddEncoding x-compress .Z

#AddEncoding x-gzip .gz .tgz

#

# 위처럼 AddEncoding을 한다면 이들의 확장된 미디어 타입도 정의 할 수 있습니다.

#

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

#

# AddHandler는 파일 확장자를 "handlers"에 매핑시켜주게 됩니다.

#

#AddHandler cgi-script .cgi

#AddHandler send-as-is asis

AddHandler type-map var

#

# .shtml files를 위한server-side includes (SSI)를 사용할 수 있도록 합니다.

#

AddType text/html .shtml

AddOutputFilter INCLUDES .shtml

#

# Action는 매칭되는 파일이 불려질 때마다 스크립트를 실행시킬 수 있도록 미디어 타입을 정의하도록 합니다.

#

# Format: Action media/type /cgi-script/location

# Format: Action handler-name /cgi-script/location

#

# 에러 응답을 정의합니다.

# 1) plain text 2) local redirects 3) external redirects

#

# Some examples:

#ErrorDocument 500 "The server made a boo boo."

#ErrorDocument 404 /missing.html

#ErrorDocument 404 "/cgi-bin/missing_handler.pl"

#ErrorDocument 402 http://www.example.com/subscription_info.html

# 모든 사용자가 위의 에러를 접하게 되지만

# 아래 라인을 추가함으로써 default HTTP_<error>.html.var files의 변경없이 메세지를 변경할 수 있습니다.

#

# Alias /error/include/ "/your/include/path/"

# 자신이 직접 만든 에러 파일의 집합을 만들 수 있습니다.

#

Alias /error/ "/var/www/error/"

<IfModule mod_negotiation.c>

<IfModule mod_include.c>

<Directory "/var/www/error">

AllowOverride None

Options IncludesNoExec

AddOutputFilter Includes html

AddHandler type-map var

Order allow,deny

Allow from all

LanguagePriority en es de fr

ForceLanguagePriority Prefer Fallback

</Directory>

# ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

# ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

# ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

# ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

# ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var

# ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

# ErrorDocument 410 /error/HTTP_GONE.html.var

# ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

# ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var

# ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

# ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var

# ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

# ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

# ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

# ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

# ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var

# ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

</IfModule>

</IfModule>

#

# 기본적인 HTTP 1.1의 반응도 처리하지 못하며 HTTP 1.0스펙을 제한하고 있는 브라우져에 대해서 HTTP 1.1 반응을 하지 못하게 하는 처리하는 것입니다.

#

BrowserMatch "Mozilla/2" nokeepalive

BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0

BrowserMatch "Java/1\.0" force-response-1.0

BrowserMatch "JDK/1\.0" force-response-1.0

# 적당한 처리가 없는 서비스에 대한 관리를 합니다.

#

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

BrowserMatch "MS FrontPage" redirect-carefully

BrowserMatch "^WebDrive" redirect-carefully

BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully

BrowserMatch "^gnome-vfs/1.0" redirect-carefully

BrowserMatch "^XML Spy" redirect-carefully

BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

#

# 서버의 상태를 점검할 수 있는 설정입니다.

# URL http://servername/server-status 이와 같은 방법으로도 서버의 상태를 점검할 수 있습니다.

# Change the ".example.com" to match your domain to enable.

#

#<Location /server-status>

# SetHandler server-status

# Order deny,allow

# Deny from all

# Allow from .example.com

#</Location>

#

# 서버의 설정에 관한 보고를 원격으로 가능하게 하고 http://servername/server-info에 mod_info.c파일이 적재되어 있어야 합니다.

# Change the ".example.com" to match your domain to enable.

#

#<Location /server-info>

# SetHandler server-info

# Order deny,allow

# Deny from all

# Allow from .example.com

#</Location>

#

# 서버를 프록시 서버를 사용할 것인지에 대한 설정을 합니다.

#<IfModule mod_proxy.c>

#ProxyRequests On

#

#<Proxy *>

# Order deny,allow

# Deny from all

# Allow from .example.com

#</Proxy>

# HTTP/1.1 "Via:" headers의 처리를 할지 안할지 설정합니다.

# ("Full" adds the server version; "Block" removes all outgoing Via: headers)

# Set to one of: Off | On | Full | Block

#

#ProxyVia On

#

# 캐시 기능에 관한 설정을 합니다.

#

#<IfModule mod_disk_cache.c>

# CacheEnable disk /

# CacheRoot "/var/cache/mod_proxy"

#</IfModule>

#

#</IfModule>

### Section 3: Virtual Hosts

# 여러 domain이나 hostname을 서버에 사용하고자 하면 가상호스트 부분의 설정을 해야 합니다.

#

# 이름을 기초로한 가상호스팅 사용. NameVirtaulHost는 포트80을 제외하고는 사용 불가.

#

#NameVirtualHost *:80

#

#

# VirtualHost 예e:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

#

#<VirtualHost *:80>

# ServerAdmin webmaster@dummy-host.example.com

# DocumentRoot /www/docs/dummy-host.example.com

# ServerName dummy-host.example.com

# ErrorLog logs/dummy-host.example.com-error_log

# CustomLog logs/dummy-host.example.com-access_log common

#</VirtualHost>

Posted by 소울하트