0. 의존성 라이브러리 설치

yum -y install gcc gcc-c++  libtermcap-devel gdbm-devel zlib* libxml* freetype* libjpeg* gd-* 

yum -y install libpng* --skip-broken pcre-devel

yum -y install openssl*


1. 아파치 파일 다운

cd /usr/local/src

wget http://mirror.apache-kr.org/httpd/httpd-2.4.23.tar.gz


2. 압축풀기

tar xvfz httpd-2.4.23.tar.gz

cd httpd-2.4.23/

(여기서 apr를 설치해야함)


3. apr 설치

wget http://mirror.apache-kr.org/apr/apr-1.5.2.tar.gz

tar zxvf apr-1.5.2.tar.gz

cd ./apr-1.5.2/

cp -arp libtool libtoolT

./configure --prefix=/usr/local/apr


make

make install


4. apr-util 설치

wget http://mirror.apache-kr.org/apr/apr-util-1.5.4.tar.gz

tar xvfz apr-util-1.5.4.tar.gz

cd apr-util-1.5.4

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

make

make install


5. 다시 아파치 설치 ㄱㄱ

cd /usr/local/src/httpd-2.4.23/

./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-rewrite --enable-ssl --enable-so 

make

make install


6. 아파치 설정

vi /etc/httpd/conf/httpd.conf


#User apache   

#Group apache   // nobody로 지정해주기위해 그전에 #으로 주석처리

User nobody

Group nobody


ServerName www.manpd.net:80 


DocumentRoot "/var/www/html"  //기본적으로 웹페이지들이 들어갈 디렉토리, 굳이 안 해줘도 됨

...

< Directory "/var/www/html">     // DocumentRoot와 동일하게 설정

...

<IfModule dir_module>            // 디렉토리의 인덱스페이지들 설정

    DirectoryIndex index.html index.php index.htm

</IfModule>

...

AddDefaultCharset UTF-8   // 기본 인코딩 설정


7. 아파치 상태확인, 서비스 가동명령어, 부팅 후 자동실행 설정

systemctl status httpd

systemctl start httpd

systemctl enable httpd.service


8. 방화벽 설정

systemctl status firewalld   // 방화벽 상태 확인

vi /etc/firewalld/zones/public.xml


<?xml version="1.0" encoding="utf-8"?>

<zone>

  <short>Public</short>

  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>

  <service name="dhcpv6-client"/>

  <service name="ssh"/>

  <port protocol="tcp" port="80"/>        // http 포트

  <port protocol="tcp" port="3306"/>    // MariaDB 포트

</zone>


systemctl reload firewalld    // 방화벽 적용



(아파치 테스트)


+ Recent posts