반응형
Apache 2.4.63 리눅스 설치 방법 | 소스 컴파일부터 기동까지 완벽 가이드
Apache 설치 테스트 환경
설치 OS : Rocky Linux release 8.10 (Green Obsidian)
설치 Apache : Apache HTTP Server 2.4.63
OS 패키지 설치
sudo yum install -y gcc gcc-c++ make pcre pcre-devel expat-devel openssl-devel wget
설치 파일 준비
# 아파치 다운로드
wget https://downloads.apache.org/httpd/httpd-2.4.63.tar.gz
# 압축 해제
tar -xzvf httpd-2.4.63.tar.gz
# 경로 이동
cd httpd-2.4.63/srclib
# apr, apr-util 다운로드
wget https://archive.apache.org/dist/apr/apr-1.7.3.tar.gz
wget https://archive.apache.org/dist/apr/apr-util-1.6.3.tar.gz
# apr 압축 해제 및 폴더명 변경
tar zxvf apr-1.7.3.tar.gz
mv apr-1.7.3 apr
# apr-util 압축 해제 및 폴더명 변경
tar zxvf apr-util-1.6.3.tar.gz
mv apr-util-1.6.3 apr-util
Apache 컴파일 설치
# 경로 이동
cd ..
# configure 실행
./configure \
--prefix=/usr/local/apache2.4 \
--enable-so \
--enable-ssl \
--enable-rewrite \
--enable-proxy \
--enable-proxy-http \
--enable-deflate \
--enable-headers \
--enable-expires \
--enable-status \
--enable-socache-shmcb \
--enable-mpms-shared=all \
--enable-mods-shared=all \
--with-mpm=event
# make 병렬 빌드
make -j$(nproc)
# 설치
make install
Apache 기동/정지 스크립트 생성
# 아파치 기동 스크립트 작성
cd /usr/local/apache2.4
vi apache_start.sh
# 파일 내용
#!/bin/bash
/usr/local/apache2.4/bin/apachectl start
:wq
# 아파치 정지 스크립트 작성
vi apache_stop.sh
# 파일 내용
#!/bin/bash
/usr/local/apache2.4/bin/apachectl stop
:wq
# 실행 권한 부여
chmod +x apache_start.sh apache_stop.sh
# PATH 등록
vi ~/.bash_profile
# 파일 내용
export PATH=$PATH:/usr/local/apache2.4
# 변경 사항 적용
source ~/.bash_profile
Apache 기동과 확인
# 어디서든 기동
apache_start.sh
# 기동 확인 - 프로세스 확인
ps -ef | grep httpd
# 기동 확인 - 포트 확인
netstat -na | grep LISTEN | grep "80 "
# 기동 확인 - 로그 확인
cd /usr/local/apache2.4/logs
vi error_log
# 로그 예시
AH00094: Command line: '/usr/local/apache2.4/bin/httpd'
Apache 정지와 확인
# 어디서든 정지
apache_stop.sh
# 정지 확인 - 프로세스 확인
ps -ef | grep httpd
# 정지 확인 - 포트 확인
netstat -na | grep LISTEN | grep "80 "
# 정지 확인 - 로그 확인
cd /usr/local/apache2.4/logs
vi error_log
# 로그 예시
AH00491: caught SIGTERM, shutting down
궁금한 점이나 잘 되지 않는 부분이 있다면 댓글로 남겨주세요.
반응형
'Web Servers' 카테고리의 다른 글
Apache와 Tomcat 연동 시 worker.properties 설정 방법 (0) | 2025.05.13 |
---|---|
Apache SSL 설정 방법 | HTTPS 가상호스트 구성 가이드 (0) | 2025.04.27 |
Apache ServerName 가상호스트 설정 방법 | 여러 도메인 운영 가이드 (0) | 2025.04.27 |
Apache 설치 및 기동 시 "ServerName" 에러 해결 방법 | AH00558 에러 분석과 해결 가이드 (0) | 2025.04.27 |
Apache 설치 중 "APR not found" 에러 해결 방법 | 원인과 해결 가이드 (0) | 2025.04.27 |