首先修改httpd.conf加载下面的模块
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_ftp_module modules/mod_proxy_ftp.so LoadModule proxy_http_module modules/mod_proxy_http.so
添加虚拟机:
<VirtualHost *:80> ServerName site.test ServerAlias *.site.test ProxyPass / http://127.0.0.1:8081/ ProxyPassReverse / http://127.0.0.1:8081/ </VirtualHost>
也可以指定目录:
<VirtualHost *:80> ServerName site.test ServerAlias *.site.test ProxyPass /proxy http://127.0.0.1:8081/proxy ProxyPassReverse /proxy http://127.0.0.1:8081/proxy </VirtualHost>