설정파일 지정하여 아파치웹서버 데몬 실행하기
작성자 정보
- 관리자 작성
- 작성일
컨텐츠 정보
- 2,813 조회
- 0 추천
- 목록
본문
설정파일
지정하여 아파치웹서버 데몬 실행하기
httpd로 아파치웹서버를 실행할 때에 -f옵션을 사용하면 임의의 아파치설정파일을 지정하여 실행할 수 있다.
하지만 아파치 실행스크립트인 apachectl을 이용하여 아파치를 실행하면 기본위치에 존재하는 httpd.conf를 사용하여 아파치를 실행한다.
여기서 설명하는 -f옵션은 기본 설정파일이 아닌 다른 아파치설정파일을 이용하여 아파치를 실행시키고자 할 때에 사용하는 방법이다.
주로 하나의 아파치에 두개이상의 설정파일을 용도별로 사용하고자 할 때 유용하다.
다음은 /usr/local/apache/conf2/httpd.conf 아파치설정파일을 이용하여 아파치를 실행하는 예이다.
[root@sulinux
bin]# ./httpd -f /usr/local/apache/conf2/httpd.conf |
즉 ps로 확인한 결과를 보면 아파치 프로세스들이 /usr/local/apache/conf2/httpd.conf 파일을 설정파일로 사용하여 실행되어 있다는 것을 알 수 있다.
아파치 홈디렉토리 지정하여 아파치웹서버 데몬 실행하기
httpd에서 -d옵션은 아파치 홈디렉토리(ServerRoot)를 지정하여 아파치를 실행하고자 할 때 사용한다.
즉 아파치 실행시에 서버루트(ServerRoot)를 지정하여 실행시킨다.
[root@sulinux
bin]# ./httpd -d /usr/local/apache |
위의 ps의 결과를 보면 아파치홈디렉토리의 위치가 /usr/local/apache로 하여 실행되었음을 알 수 있다.
시스템에
설치되어 있는 아파치웹서버 버전 확인하기
httpd에서 -v옵션은 현재 실행중인 아파치의 버전과 컴파일된 시간을 확인해 준다.
아래의 예를 보면 현재 실행중인 아파치의 버전이 2.2.11이라는 것과 컴파일된 시간이 2019년 4월 15일 오전 01시 20분 10초라는 것을 알려주고 있다.
[root@sulinux bin]#/usr/local/apache/bin/httpd -v Server version: Apache/2.2.11 (Unix) Server built: Apr 15 2019 01:20:10 [root@sulinux bin]# |
필자의 기우이겠지만 위의 시각은 현재 아파치가 실행되어있는 시각이 아니라 아파치웹서버를 시스템에 설치할 때에 아파치웹서버의 소스를 컴파일한 시각을 의미한다.
즉 언제 아파치를 컴파일하여 설치하였는가를 확인할 수 있다.
아파치 컴파일
설치내용 확인하기
httpd에서 -V옵션은 아파치를 컴파일하여 설치한 설정내용을 확인시켜 준다.
아래의 예를 보면 아파치의 기본적인 설치내용과 설치위치등을 확인할 수 있다.
[root@sulinux bin]#/usr/local/apache/bin/httpd -V Server version: Apache/2.2.11 (Unix) Server built: Apr 15 2019 01:20:10 Server's Module Magic Number: 20191115:21 Server loaded: APR 1.3.3, APR-Util 1.3.4 Compiled using: APR 1.3.3, APR-Util 1.3.4 Architecture: 32-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT="/usr/local/apache" -D SUEXEC_BIN="/usr/local/apache/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" [root@sulinux bin]# |
위의 결과를 보면 아파치웹서버의 컴파일 정보들을 확인할 수 있다.
즉 아파치웹서버의 버전, 컴파일된 일시, 컴파일옵션등을 상세하게 확인할 수 있다.
아파치웹서버에
설치되어있는 아파치 모듈들 확인하기
httpd에서 -l옵션은 아파치에 설치되어 현재 사용가능한 아파치모듈들을 확인시켜 준다.
운용중인 아파치모듈을 확인하고자 할 때 주로 사용한다.
즉 필요한 모듈이 아파치에 설정되어있는가를 확인 할 수 있다.
[root@sulinux bin]#/usr/local/apache/bin/httpd -l Compiled in modules: core.c mod_authn_file.c mod_authn_default.c mod_authz_host.c mod_authz_groupfile.c mod_authz_user.c mod_authz_default.c mod_auth_basic.c mod_include.c mod_filter.c mod_log_config.c mod_env.c mod_setenvif.c mod_ssl.c prefork.c http_core.c mod_mime.c mod_status.c mod_autoindex.c mod_asis.c mod_cgi.c mod_negotiation.c mod_dir.c mod_actions.c mod_userdir.c mod_alias.c mod_so.c [root@sulinux bin]# |
즉 위의 결과를 보면 현재 로딩된 아파치웹서버의 모듈들을 확인할 수 있다.
아파치웹서버
설정지시자 확인하기
httpd에서 -L옵션은 현재 아파치의 아파치 설정지시자(configuration directives)를 확인 할 수 있다.
아파치에는 많은 설정지시자가 있으며 아래 결과는 그 일부분이다.
[root@sulinux bin]#/usr/local/apache/bin/httpd -L <Directory (core.c) Container for directives affecting resources located in the specified directories Allowed in *.conf only outside <Directory>, <Files> or <Location> <Location (core.c) Container for directives affecting resources accessed through the specified URL paths Allowed in *.conf only outside <Directory>, <Files> or <Location> <VirtualHost (core.c) Container to map directives to a particular virtual host, takes one or more host addresses Allowed in *.conf only outside <Directory>, <Files> or <Location> <Files (core.c) Container for directives affecting files matching specified patterns Allowed in *.conf anywhere and in .htaccess when AllowOverride isn't None <Limit (core.c) Container for authentication directives when accessed using specified HTTP methods Allowed in *.conf anywhere and in .htaccess when AllowOverride isn't None |
만약 특정 지시자만을 확인코자 한다면 "./httpd -L | grep 지시자명"과 같이 사용하면 된다.
아파치웹서버에
설정되어있는 가상호스트 확인하기
httpd에서 -S옵션은 아파치에 설정된 가상호스트를 확인해 준다.
가상호스트는 httpd.conf파일의 맨 마지막에 설정되는 것으로 직접 httpd.conf파일을 vi로 열어서 확인해 보면 알 수 있지만 현재 운용중인 아파치에 설정되어 있는 가상호스트를 확인하고자 한다면 아래와 같이 -S옵션을 사용하기 바란다.
[root@sulinux extra]#/usr/local/apache/bin/httpd -t -D DUMP_VHOSTS VirtualHost configuration: 192.168.0.250:* is a NameVirtualHost default server www.picasso.co.kr (/usr/local/apache/conf/extra/httpd-vhosts.conf:28) port * namevhost www.picasso.co.kr (/usr/local/apache/conf/extra/httpd-vhosts.conf:28) port * namevhost www.owner.co.kr (/usr/local/apache/conf/extra/httpd-vhosts.conf:37) Syntax OK [root@sulinux extra]# |
즉 위의 결과를 보면 현재 하나의 아파치웹서버에 설정되어 있는 가상호스트는 기본 호스트를 제외하여 2개임을 알 수 있다.
아래는 위에서 확인한 가상호스트 리스트이다.
즉 이번 예에서 아파치웹서버를 호스팅서버에 설치하여 호스팅용으로 사용하고 있을 때에 현재 서버에서 서비스하고 있는 호스팅 도메인리스트를 확인할 때에 유용하다는 것을 알 수 있다.
httpd.conf파일 문법(주로 DocumentRoot 지시자의 유효성)검사하기
아파치의 설정파일인 httpd.conf의 문법을 검사하는 옵션으로 -t를 사용한다.
이 옵션은 DocumentRoot에 설정된 값의 유효성을 확인하면서 아파치설정파일(httpd.conf)의 문법을 검사한다.
아래의 결과를 보다시피 현재 httpd.conf의 문법은 DocumentRoot지시자의 내용을 포함하여 아무런 이상이 없음을 알 수 있다.
[root@sulinux extra]#/usr/local/apache/bin/httpd -t Syntax OK [root@sulinux extra]# |
참고로 “/usr/local/apache/bin/apachectl configtest”명령어는 httpd.conf 전체의 문법검사를 한다는 점을 알아두기 바란다.
관련자료
-
이전
-
다음