
저는 Apache/2.4.29(Ubuntu)를 사용하고 있으며 내부 웹 서버용 역방향 프록시 서버로 구성했습니다. 내 역방향 프록시 서버 주소는 공개적으로 노출되는 10.0.0.1이고 내부 서버 주소는 개인 서버인 192.168.1.15입니다. 가상 호스트 구성 파일은 아래와 같습니다.
ServerName web.example.com
ServerAlias web.example.com
ProxyRequests off
ProxyPreserveHost On
ProxyPass / http://192.168.1.15/web/public/
ProxyPassReverse / http://192.168.1.15/web/public/
ProxyPassReverseCookiePath / /
<Location "/">
Order allow,deny
Allow from all
</Location>
ErrorLog ${APACHE_LOG_DIR}/web-error.log
CustomLog ${APACHE_LOG_DIR}/web-access.log combined
예상 결과:http://web.example.com실제 결과:http://web.example.com/web/public/
URL을 컬링하면 .. $curl -vhttp://web.example.com
Trying 10.0.0.1...
TCP_NODELAY set
Connected to web.example.com (10.0.0.1) port 80 (#0)
GET / HTTP/1.1
Host: web.example.com
User-Agent: curl/7.58.0
Accept: /
HTTP/1.1 302 Found
Date: Sun, 30 Aug 2020 13:28:09 GMT
Server: Apache/2.4.29 (Ubuntu)
Cache-Control: no-cache, private
Location: http://web.example.com/web/public/
Content-Length: 522
Content-Type: text/html; charset=UTF-8