서버

[CentOS7] Apache HTTP Server Version 2.4 (Source)

검은체리 2019. 11. 20. 13:32

 

1. 설치전 필수 라이브러리 설치

yum install autoconf expat-devel libtool libnghttp2-devel pcre-devel -y

 

2. Apache 다운로드 및 압축해제

 

cd /sw

wget https://github.com/apache/httpd/archive/2.4.33.tar.gz

tar -xzf 2.4.33.tar.gz

 

3. Web-module 폴더 생성 및 다운로드

 

mkdir -p /sw/web-modules

cd /sw/web-modules

 

wget https://github.com/apache/apr/archive/1.6.3.tar.gz

wget https://github.com/apache/apr-util/archive/1.6.1.tar.gz

wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.bz2

 

tar -xzf 1.6.3.tar.gz

tar -xzf 1.6.1.tar.gz

tar -xjf pcre-8.41.tar.bz2

 

4.  apr 파일 복사

 

cp -r apr-1.6.3 /sw/httpd-2.4.33/srclib/apr

cp -r apr-util-1.6.1 /sw/httpd-2.4.33/srclib/apr-util

cp -r pcre-8.41 /sw/httpd-2.4.33/srclib/pcre

 

5. 컴파일 

 

mkdir -p /sw/apache/httpd-2.4.33

cd /sw/httpd-2.4.33

 

./buildconf

./configure --prefix=/sw/apache/httpd-2.4.33

 

make

make install

 

5. 방화벽 해제

 

firewall-cmd --permanent --add-port=80/tcp

firewall-cmd --reload

 

6. 서비스 파일 추가

 

vi /etc/systemd/system/httpd.service

[Unit]
Description=The Apache HTTP Server
After=network.target

[Service]
Type=forking
ExecStart=/sw/apache/httpd-2.4.33/bin/apachectl -k start
ExecReload=/sw/apache/httpd-2.4.33/bin/apachectl -k graceful
ExecStop=/sw/apache/httpd-2.4.33/bin/apachectl -k graceful-stop
# PIDFile=/sw/apache/httpd-2.4.33/logs/httpd.pid
PrivateTmp=true

[Install]
WantedBy=multi-user.target

7. 서비스 등록 및 시작

systemctl daemon-reload

systemctl enable httpd

 

systemctl start httpd

systemctl status httpd

 

참고로 각종 설정은 아래에서 파일 수정

/sw/apache/httpd-2.4.33/conf/httpd.conf

 

검증