Linux/CentOS

CentOS 7 에서 Apache Web Server 2.4 설치하기

후뤼한잉여 2015. 11. 11. 00:11

CentOS 7 에서 Apache Web Server 2.4 설치하기

1) 개요

개인적인 웹 서버 구축시 설치 한 내용을 정리하고자 작성되었습니다.

2) 설치하기

  1. JDK 설치하기
  2. 의존 패키지 설치하기
    sudo yum -y install gcc gcc-c++ wget
    
  3. 설치할 파일들 다운로드
    wget http://mirror.apache-kr.org//httpd/httpd-2.4.16.tar.gz
    wget http://mirror.apache-kr.org//apr/apr-1.5.2.tar.gz
    wget http://mirror.apache-kr.org//apr/apr-util-1.5.4.tar.gz
    wget http://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.tar.gz
    
  4. 설치할 파일들 압축 해제하기
    tar -zxvf httpd-2.4.16.tar.gz
    tar -zxvf apr-1.5.2.tar.gz
    tar -zxvf apr-util-1.5.4.tar.gz
    tar -zxvf pcre-8.37.tar.gz
    
  5. Apache Web Server 설치시 필요 파일 이동하기
    mv [APR 압축 풀린 디렉토리] ./[Apache Web Server 압축 풀린 디렉토리]/srclib/apr
    mv [APR-Util 압축 풀린 디렉토리] ./[Apache Web Server 압축 풀린 디렉토리]/srclib/apr-util
    
  6. PRCE 설치하기
    cd [PRCE 압축 풀린 디렉토리]
    sudo ./configure
    sudo make
    sudo make install
    
  7. Apache Web Server 설치하기
    cd [Apache Web Server 압축 풀린 디렉토리]
    sudo ./configure --prefix=[Apache Web Server 설치할 디렉토리] --with-included-apr
    sudo make
    sudo make install
    
  8. Apache Web Server 설정하기
    vi [Apache Web Server 설치된 디렉토리]/conf/httpd.conf
    
    httpd.conf파일에 수정할 내용
    ServerName localhost //중간에 ServerName 주석 지우고 localhost 입력
    
  9. 방화벽 해제하기
    sudo firewall-cmd --permanent --add-service=http
    sudo systemctl reload firewalld
    
  • Apache Web Server 실행 / 종료 명령어
    • 실행 명령어
      [Apache Web Server 설치된 디렉토리]/bin/httpd -k start
      또는
      [Apache Web Server 설치된 디렉토리]/app/apache/bin/apachectl start
      
    • 종료 명령어
      [Apache Web Server 설치된 디렉토리]/bin/httpd -k stop
      또는
      [Apache Web Server 설치된 디렉토리]/app/apache/bin/apachectl stop