반응형
Linux 환경에 설치 및 설정
설명
- 주의사항
- 해당 방법은 2.2.x 버전에 해당함, 2.4.x버전은 pcre, apr 같은 패키지도 같이 설치해야함
- 2.4.x 버전 설치는 아래 참고
- 참고 URL
openssl libssl-dev 설치
sudo apt-get install openssl libssl-dev
Apache 설치
mkdir -p /home/ubuntu/app \
&& cd /home/ubuntu/app \
&& wget http://mirror.navercorp.com/apache/httpd/httpd-2.2.34.tar.gz \
&& sudo tar xvfz httpd-*.tar.gz \
&& cd httpd-* \
&& sudo ./configure --prefix=/home/ubuntu/app/apache-2.2.34 --enable-rule=SHARED_CORE --enable-module=so --enable-ssl --enable-module=rewrite --enable-so \
&& sudo make && sudo make install \
&& cd /home/ubuntu/app \
&& sudo rm -rf httpd-* \
&& ln -s -Tfs apache-2.2.34 apache \
&& sudo /home/ubuntu/app/apache-2.2.34/bin/apachectl start \
&& sleep 5s \
&& curl "http://localhost" \
&& sleep 5s \
&& sudo /home/ubuntu/app/apache-2.2.34/bin/apachectl stop
httpd.conf 파일 수정
- 경로 : 아파치홈/conf/httpd.conf
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
-> ErrorLog 설정 수정, CustomLog 주석 처리
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t %{HOST}i \"%r\" %>s %b" common
-> 요청 호스트 정보도 출력할 수 있도록 LogFormat 변경
Include conf/extra/httpd-vhosts.conf
-> 하단에 추가
httpd-vhosts.conf 파일 수정
- 경로 : 아파치홈/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName dev.runoffapp.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/docBase"
<Directory "/home/ubuntu/deploy/docBase">
#Options Indexes FollowSymLinks # index of 디렉토리 노출 허용 설정
AllowOverride None
Allow from all
<LimitExcept GET POST>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</VirtualHost>
Windows 환경에서 설치 및 설정
Apache 설치
- 아파치 다운로드 URL
- C:/Program Files/Apache/Apache24 경로에 압축 해제
httpd.conf 파일 수정
- 경로 : 아파치홈/conf/httpd.conf
ServerName localhost:80
Include conf/extra/httpd-vhosts.conf
c:/Apache24 -> C:/Program Files/Apache/Apache24
-> 기존 경로 설정을 압축 해제한 경로로 변경
환경변수 설정
- 고급 시스템 설정 보기 > 환경변수
- 시스템 변수 > path 선택 > 편집
- "C:\Program Files\Apache\Apache24\bin" 경로 추가
설치 확인
- 관리자 권한으로 cmd 창 열어 명령어 실행
- 명령어1 : httpd -k install
- 명령어2 : httpd -k start
- 접속 후 It Works!가 뜨는지 확인
반응형
'Development > Apache & Tomcat' 카테고리의 다른 글
[Apache] SSL 설정(Let's Encrypt) (0) | 2018.03.27 |
---|---|
[Apache] Log Rotation 적용 (0) | 2018.03.27 |
[Apache] Request Method 제한 설정 (0) | 2018.03.27 |
[Apache] 에러 페이지 설정 (0) | 2018.03.27 |
[Apache] 명령어 (0) | 2018.03.27 |