새소식

반응형
Server/CentOS 7

Apache Web Server 설치 및 설정

  • -
반응형

1. Apache Web Server 설치여부 확인 및 설치

: rpm -qa | grep httpd

: yum install -y httpd

2. httpd.conf 파일 확인

: vi /etc/httpd/conf/httpd.conf

: Listen port 80 확인

3. Apache Web Server 구동

: cd /etc/httpd/conf.d/welcome.conf

welcome.conf 파일 내용 주석처리

: cd /var/www/html

: 해당 디렉토리에 index 파일 생성

: html 코드 작성

: systemctl restart httpd

4. 작성한 html 코드 화면 확인

 

* Reverse proxy 설정

: vi /etc/httpd/conf.d/proxy.conf 파일 생성

: 아래 내용 추가

ProxyRequests Off

ProxyVia Off

ProxyPreserveHost On

ProxyPass / http://localhost:8080/

ProxyPassReverse / http://localhost:8080/

or (정규표현식을 사용하기 위해선 ProxyPassMatch)

ProxyPassMatch ^/(.*) http://localhost:8080/$1

ProxyPassReverse ^/(.*) http://localhost:8080/$1

* $1 : path의 내용이 맞을경우 괄호안의 내용을 덧붙인다.

저장 후 종료

 

* Reverse Proxy ​에러 확인 (경로 : /etc/httpd/logs/error_log)

 

: /usr/sbin/setsebool -P httpd_can_network_connect true

: systemctl restart httpd

화면 확인

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.