반응형
설명
- /home/ubuntu/app 디렉토리에 설치
- /home/ubuntu/deploy/resources 디렉토리 하위 정적 파일을 서비스하도록 설정
- apache01.example.com을 도메인으로 서비스하기위한 설정
- 2.2.x 버전 설치는 아래 참고
필수 패키지 설치
sudo apt-get install openssl libssl-dev \
&& sudo apt-get install gcc \
&& sudo apt-get install build-essential \
&& sudo apt-get install libexpat1-dev
apr 설치
mkdir -p /home/ubuntu/app \
&& cd /home/ubuntu/ \
&& wget http://apache.mirror.cdnetworks.com//apr/apr-1.7.0.tar.gz \
&& sudo tar xvfz apr-*.tar.gz \
&& rm apr-*.tar.gz \
&& cd apr-* \
&& sudo ./configure --prefix=/home/ubuntu/app/`ls /home/ubuntu | grep "apr-[0-9]"` \
&& sudo cp libtool libtoolT \
&& sudo ./configure --prefix=/home/ubuntu/app/`ls /home/ubuntu | grep "apr-[0-9]"` \
&& sudo make \
&& sudo make install \
&& sudo rm -rf /home/ubuntu/apr-*
apr-util 설치
mkdir -p /home/ubuntu/app \
&& cd /home/ubuntu/ \
&& wget http://apache.mirror.cdnetworks.com//apr/apr-util-1.6.1.tar.gz \
&& sudo tar xvfz apr-util-*.tar.gz \
&& rm apr-util-*.tar.gz \
&& cd apr-util-* \
&& sudo ./configure --prefix=/home/ubuntu/app/`ls /home/ubuntu | grep "apr-util-[0-9]"` --with-apr=/home/ubuntu/app/`ls /home/ubuntu/app | grep "apr-[0-9]"` \
&& sudo make \
&& sudo make install \
&& sudo rm -rf /home/ubuntu/apr-util-*
pcre 설치
mkdir -p /home/ubuntu/app \
&& cd /home/ubuntu/ \
&& wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz \
&& sudo tar xvfz pcre-*.tar.gz \
&& rm pcre-*.tar.gz \
&& cd pcre-* \
&& sudo ./configure --prefix=/home/ubuntu/app/`ls /home/ubuntu | grep "pcre-[0-9]"` \
&& sudo make \
&& sudo make install \
&& sudo rm -rf /home/ubuntu/pcre-*
httpd 설치
mkdir -p /home/ubuntu/app \
&& cd /home/ubuntu/ \
&& wget http://apache.mirror.cdnetworks.com//httpd/httpd-2.4.39.tar.gz \
&& sudo tar xvfz httpd-*.tar.gz \
&& rm httpd-*.tar.gz \
&& cd httpd-* \
&& sudo ./configure \
--prefix=/home/ubuntu/app/`ls /home/ubuntu | grep "httpd-[0-9]"` \
--with-apr=/home/ubuntu/app/`ls /home/ubuntu/app | grep "apr-[0-9]"` \
--with-apr-util=/home/ubuntu/app/`ls /home/ubuntu/app | grep "apr-util-[0-9]"` \
--with-pcre=/home/ubuntu/app/`ls /home/ubuntu/app | grep "pcre-[0-9]"` \
--enable-mods-shared=most \
--enable-module=so \
--enable-rewrite \
&& sudo make \
&& sudo make install \
&& sudo rm -rf /home/ubuntu/httpd-* \
&& ln -Tfs /home/ubuntu/app/httpd-* /home/ubuntu/app/apache
DocumentRoot 디렉토리 세팅
mkdir -p /home/ubuntu/deploy/resources \
&& cp /home/ubuntu/app/apache/htdocs/index.html /home/ubuntu/deploy/resources
httpd.conf 수정
sudo vi /home/ubuntu/app/apache/conf/httpd.conf
# 서버 호스트 설정
ServerName localhost:80
# ErrorLog 설정 수정, CustomLog 주석 처리
ErrorLog "|/home/ubuntu/app/apache/bin/rotatelogs /home/ubuntu/app/apache/logs/error.%Y-%m-%d.log 86400 +540"
#CustomLog "|/home/ubuntu/app/apache/bin/rotatelogs /home/ubuntu/app/apache/logs/access.%Y-%m-%d.log 86400 +540" common
# 요청 호스트 정보도 출력할 수 있도록 LogFormat 변경
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t %{HOST}i \"%r\" %>s %b" common
# httpd-vhosts.conf 설정 포함
Include conf/extra/httpd-vhosts.conf
httpd-vhosts.conf 수정
sudo vi /home/ubuntu/app/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName apache01.example.com
CustomLog "|/home/ubuntu/app/apache/bin/rotatelogs /home/ubuntu/app/apache/logs/access.%Y-%m-%d.log 86400 +540" common
DocumentRoot "/home/ubuntu/deploy"
<Directory "/home/ubuntu/deploy/resources">
#Options Indexes FollowSymLinks # index of 디렉토리 노출 허용 설정
AllowOverride None
Allow from all
Require all granted
<LimitExcept GET POST>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</VirtualHost>
아파치 설치 확인(It Works! 확인)
sudo /home/ubuntu/app/apache/bin/apachectl start \
&& curl http://localhost/resources/index.html \
&& sudo /home/ubuntu/app/apache/bin/apachectl stop
[이슈] 설치중 "make command not found" 오류 발생
sudo apt-get install build-essential
[이슈] apr-util 설치중 "fatal error: expat.h: No such file or directory #include <expat.h>" 오류 발생
sudo apt-get install libexpat1-dev
참고
반응형
'Development > Apache & Tomcat' 카테고리의 다른 글
[Apache] Load Balancer 설정 (0) | 2019.03.09 |
---|---|
[Apache] Proxy 설정 (0) | 2019.03.09 |
[Tomcat] 설치하기 (0) | 2018.07.29 |
[Apache] mod_jk 설치 (0) | 2018.03.27 |
[Apache] SSL 설정(Let's Encrypt) (0) | 2018.03.27 |