Apache | Apache 기본 설정 | 설정 파일(httpd.conf) 위치와 보조 설정 파일 읽기

Apache의 설정은 http.conf 파일에서 하는데, 다른 파일에 설정을 작성하고 이를 http.conf 파일에 포함시킬 수도 있다. 여기에서는 http.conf 파일의 위치와 별도로 준비한 보조 설정 파일을 포함 시키는 방법을 대해 설명한다.

http.conf 파일의 위치

Apache를 설치하면 파일 구성은 다음과 같다.

C:\apache\Apache24>dir
 C 드라이브의 볼륨에는 이름이 없습니다.
 볼륨 일련 번호: XXXX-XXX

 C:\apache\Apache24 디렉터리

2019-11-26  오후 10:39    <DIR>          .
2019-11-26  오후 10:39    <DIR>          ..
2015-04-16  오전 05:53            13,740 ABOUT_APACHE.txt
2019-11-26  오후 10:39    <DIR>          bin
2019-11-26  오후 10:39    <DIR>          cgi-bin
2019-08-09  오후 11:37                59 CHANGES.txt
2019-11-26  오후 10:39    <DIR>          conf
2019-11-26  오후 10:39    <DIR>          error
2019-11-26  오후 10:39    <DIR>          htdocs
2019-11-26  오후 10:39    <DIR>          icons
2019-11-26  오후 10:39    <DIR>          include
2016-05-18  오전 02:59             3,869 INSTALL.txt
2019-11-26  오후 10:39    <DIR>          lib
2019-08-09  오후 11:38            44,480 LICENSE.txt
2019-11-28  오후 12:30    <DIR>          logs
2019-11-26  오후 10:39    <DIR>          manual
2019-11-26  오후 10:39    <DIR>          modules
2019-08-09  오후 11:38             2,865 NOTICE.txt
2019-08-09  오후 11:50            41,993 OPENSSL-NEWS.txt
2019-08-09  오후 11:50             4,545 OPENSSL-README.txt
2014-01-24  오전 01:33             4,752 README.txt
               8개 파일             116,303 바이트
              13개 디렉터리  459,275,866,112 바이트 남음

C:\apache\Apache24>

Apache 설정 파일은 http.conf 파일은 “(설치 디렉터리)\Apache24\conf"디렉터리에 들어 있다.

C:\apache\Apache24\conf>dir
 C 드라이브의 볼륨에는 이름이 없습니다.
 볼륨 일련 번호: XXXX-XXX

 C:\apache\Apache24\conf 디렉터리

2019-11-26  오후 10:39    <DIR>          .
2019-11-26  오후 10:39    <DIR>          ..
2019-08-09  오후 11:50             1,820 charset.conv
2019-11-26  오후 10:39    <DIR>          extra
2019-11-28  오후 12:30            20,555 httpd.conf
2019-08-09  오후 11:50            13,449 magic
2019-08-09  오후 11:50            62,702 mime.types
2019-05-28  오후 10:12            11,259 openssl.cnf
2019-11-26  오후 10:39    <DIR>          original
               5개 파일             109,785 바이트
               4개 디렉터리  459,279,749,120 바이트 남음

C:\apache\Apache24\conf>

설정 변경을 하기 전에 백업으로 http.conf 파일을 다른 이름으로 복사하여 저장해 둔다. 설정을 변경하려면 http.conf 파일은 텍스트 파일이므로 텍스트 편집기를 사용하여 파일을 불러온다.

보조 설정 파일을 포함시키는 방법

현재 버전에서는 일부 설정 항목에 대해서는 별도의 파일로 분리하고, 필요에 따라 httpd.conf 파일에서 가져 올 수 있게 되어 있다. 기본적으로 제공되는 보조 설정 파일은 “(설치 디렉터리)\Apache24\conf\ext "디렉터리에 저장되어 있다.

http.conf 파일에서 다른 설정 파일을 가져 오려면 Include 지시어를 사용한다. 구체적인 예로 http.conf 파일의 마지막 부분을 보면, 다음과 같은 내용이 있다.

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be 
# included to add extra features or to modify the default configuration of 
# the server, or you may simply copy their contents here and change as 
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

지금은 모두 “#“이 맨 앞에 있어 주석이서서, 실제로는 보조 설정 파일을 가져 오지 않고 있다. 여기서 사용자 디렉터리에 대한 보조 설정 파일을 가져 오고 싶다면 문장의 앞에 있는 “#“을 삭제하고 다음과 같이 작성한다.

# User home directories
Include conf/extra/httpd-userdir.conf

이제 보조 설정 파일인 “conf/extra/httpd-userdir.conf"파일이 포함된다. Include 지시어 사용에 대한 자세한 내용은 “설정 파일 가져오기 (Include)“를 참조한다.




최종 수정 : 2019-12-10