Apache HTTP Server

Apache HTTP Server 2.4.29 Installation on Amazon Linux

sstdio.h·2018년 1월 8일·조회 8,209

1. 개요

Amazon Linux에 Apache HTTP Server 2.4.29를 소스에서 설치한다.


2. 준비물

아래 예시는 설치 경로를 /sw/apache/2.4.29로 지정한 경우이다. 다른 경로에 설치하려면 --prefix 값만 변경하면 된다.


3. configure

3-1. configure 실행

# ./configure --prefix=/sw/apache/2.4.29 --enable-mods-shared=most

3-2. error: APR not found

configure: error: APR not found.  Please read the documentation.

해결책은 다음과 같다.

# yum install apr-util-devel

apr-util-devel을 설치하면 APR 관련 헤더와 라이브러리 의존성을 함께 해결할 수 있다.

3-3. error: C compiler cannot create executables

configure: error: C compiler cannot create executables

해결책은 다음과 같다.

# yum install gcc

3-4. error: pcre-config for libpcre not found

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

해결책은 다음과 같다.

# yum install pcre-devel

3-5. configure 성공

configure: summary of build options:

    Server Version: 2.4.29
    Install prefix: /sw/apache/2.4.29
    C compiler:     gcc -std=gnu99
    CFLAGS:           -pthread
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE
    LDFLAGS:
    LIBS:
    C preprocessor: gcc -E

4. make

configure가 정상적으로 끝나면 컴파일을 진행한다.

# make

컴파일 중 오류가 발생하면 앞 단계에서 누락된 개발 패키지가 없는지 확인한다.


5. make install

컴파일이 끝나면 지정한 설치 경로로 파일을 설치한다.

# make install
Installing configuration files
mkdir /sw/apache/2.4.29/conf
mkdir /sw/apache/2.4.29/conf/extra
mkdir /sw/apache/2.4.29/conf/original
mkdir /sw/apache/2.4.29/conf/original/extra
Installing HTML documents
mkdir /sw/apache/2.4.29/htdocs
Installing error documents
mkdir /sw/apache/2.4.29/error
Installing icons
mkdir /sw/apache/2.4.29/icons
mkdir /sw/apache/2.4.29/logs
Installing CGIs
mkdir /sw/apache/2.4.29/cgi-bin
Installing header files
mkdir /sw/apache/2.4.29/include
Installing build system files
mkdir /sw/apache/2.4.29/build
Installing man pages and online manual
mkdir /sw/apache/2.4.29/man
mkdir /sw/apache/2.4.29/man/man1
mkdir /sw/apache/2.4.29/man/man8
mkdir /sw/apache/2.4.29/manual
make[1]: Leaving directory `/sw/installer/httpd-2.4.29'

6. 설치 파일 확인

6-1. httpd -v

# ./httpd -v
Server version: Apache/2.4.29 (Unix)
Server built:   Jan  8 2018 11:58:18

6-2. httpd -V

# ./httpd -V
Server version: Apache/2.4.29 (Unix)
Server built:   Jan  8 2018 11:58:18
Server's Module Magic Number: 20120211:68
Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -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=256
 -D HTTPD_ROOT="/sw/apache/2.4.29"
 -D SUEXEC_BIN="/sw/apache/2.4.29/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
  • 이벤트 방식 MPM으로 설치되었음을 알 수 있다.
  • httpd.confmodules 디렉터리를 확인한 결과 mod_ssl.so 파일은 존재하지 않는다. 주석 처리된 것이 아니라 모듈 파일 자체를 찾을 수 없는 상태이다.
  • httpd.conf 확인 결과 mod_proxy 관련 모듈은 로드되어 있지 않다.
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so

설정 파일 문법은 다음 명령으로 확인할 수 있다.

# /sw/apache/2.4.29/bin/httpd -t

7. SSL 지원

7-1. --enable-ssl

SSL을 지원하기 위해 옵션을 추가하여 다시 빌드한다.

# ./configure --prefix=/sw/apache/2.4.29 --enable-mods-shared=most --enable-ssl

7-2. error: mod_ssl has been requested but can not be built due to prerequisite failures

checking whether to enable mod_ssl... checking dependencies
checking for OpenSSL... checking for user-provided OpenSSL base directory... none
checking for OpenSSL version >= 0.9.8a... FAILED
configure: WARNING: OpenSSL version is too old
no
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures

해결책은 다음과 같다.

# yum install openssl-devel

openssl-devel 설치 후 다시 configure, make, make install을 실행한다.

7-3. 설치 후 확인

modules 디렉터리를 확인한 결과 mod_ssl.so 파일이 존재한다. 단, httpd.conf에는 아직 로드되어 있지 않다.

#LoadModule ssl_module modules/mod_ssl.so

또한 httpd.conf 파일에 아래와 같은 내용이 추가되었다.

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

댓글 0

로그인 후 댓글을 남길 수 있습니다.

아직 댓글이 없습니다.