[Apache] Reverse Proxy 사용 포트포워딩 설정하기

2021. 4. 26. 20:43·Tech Archive/Apache

 

외부에서 접속했을때 내부서버의 다른 포트나 다른곳으로 연결해주기위해

Reverse Proxy를 사용한다

여러 방법이 있지만 Apache 에 기본으로 설치되는 mod_proxy를 사용해 설정 할 수 있다.

 

mod_proxy 모듈 설정

#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_http_module modules/mod_proxy_http.so

- /apache/conf/httpd.conf 파일을 열어 주석된 부분을 풀어주거나 없으면 추가해준다

 

 

httpd.conf 파일 수정

<VirtualHost *:80>
  ServerName test.com
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / http://localhost:8080/
  ProxyPassReverse / http://localhost:8080/
</VirtualHost>

 

Apache 재시작

 

재시작 후 서버도메인으로 들어오면 http://localhost:8080 으로 접속된다

 

 

 

Location 추가하여 접속량 분산하기

<VirtualHost *:80>
  ServerName test.com
  ProxyRequests Off
  ProxyPreserveHost On
  <Location /test1>
    ProxyPass http://test1.test.com/
    ProxyPassReverse http://test1.test.com/
  </Location>
  <Location /test2>
    ProxyPass http://test2.test.com/
    ProxyPassReverse http://test2.test.com/
  </Location>
</VirtualHost>

Location을 추가하면 test.com/test1 로 접속시 test1.test.com 으로 접속되어 처리할 수 있다

이와같은 경우는 test.com 의 접속량이 많을경우 Proxy를 써서 서버를 나누어 분산처리 함으로써 서버의 부하를 줄여 줄 수 있다

 

 

 

mod_proxy Apache 사이트

httpd.apache.org/docs/2.4/mod/mod_proxy.html

 

mod_proxy - Apache HTTP Server Version 2.4

Apache Module mod_proxy Summary Warning Do not enable proxying with ProxyRequests until you have secured your server. Open proxy servers are dangerous both to your network and to the Internet at large. mod_proxy and related modules implement a proxy/gatewa

httpd.apache.org

 

'Tech Archive > Apache' 카테고리의 다른 글

[Apache] Apache Vhost 세팅 (React, SpringBoot) - PM2 배포 시  (0) 2026.06.18
[Apache] Apache Vhost 폴더경로와 ProxyPass 동시 설정  (0) 2026.06.18
[Apache] Apache Tomcat 연동  (0) 2021.02.25
'Tech Archive/Apache' 카테고리의 다른 글
  • [Apache] Apache Vhost 세팅 (React, SpringBoot) - PM2 배포 시
  • [Apache] Apache Vhost 폴더경로와 ProxyPass 동시 설정
  • [Apache] Apache Tomcat 연동
roundfigure
roundfigure
알 수 없는 에러, 기술, 그리고 딱 떨어지는 해답. 사방으로 흩어진 모호한 문제들, 매끄러운 'Round Figure'로 정리하고 싶은 블로그.
  • roundfigure
    Round Figure
    roundfigure
  • 전체
    오늘
    어제
    • 전체 글 (111) N
      • Tech Archive (40)
        • Linux (2)
        • Linux(CentOS) (9)
        • Apache (4)
        • SpringBoot (3)
        • React (0)
        • Javascript (8)
        • JSTL (5)
        • 웹접근성 (4)
        • MySQL (2)
        • Unity (0)
        • ETC (3)
      • Trend (17)
      • AI활용 (37)
      • Hosting & Infra (5) N
      • Automation & Lab (1)
      • Error & Trouble Shooting (11)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • StackFreeks
    • StackFreeksTools
    • zeuz
    • hydok
  • 공지사항

  • 인기 글

  • 태그

    ai 코딩 도구
    웹접근성
    apache
    Claude Cowork
    mysql
    JSTL
    CursorRules
    javascript
    claude code
    CentOS 7
    VPS 비교
    설치
    jquery
    CLAUDE.md
    프로그래밍
    Linux
    SWE-bench
    클로드 코워크
    Proxy
    리눅스
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.6
roundfigure
[Apache] Reverse Proxy 사용 포트포워딩 설정하기
상단으로

티스토리툴바