首先安裝反向代理the Reverse Proxy
sudo a2enmod proxy proxy_http
然後在Apache中配置反向代理configuration of the reverse proxy.
cd /etc/apache2/sites-available
sudo vim 000-default.conf
加入下面內容
ProxyPreserveHost On #開啓反向代理
ProxyRequests off #關閉正向代理
# Allow from everywhere
<Proxy *>
Order deny,allow
Allow from all #代理任何
</Proxy>
# Send all requests to port 8080 將請求發到8080端口,如果8080是nginx的話,nginx處理請求,並且mod_security正常運行攔截
ProxyPass / http://www.test.com:8080/
ProxyPa***everse / http://www.test.com:8080/