Apache反向代理配置

1、修改APACHE配置文件httpd.conf

修改加载模块

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

2、修改虚拟目录配置httpd-vhost.conf

<VirtualHost>

ServerName ?www.test.com #设置需要代理的域名

ServerAias ?www.test.com

<Proxy http://www.test.com>

Options MultiViews

AllowOverride None

Order allow,deny

Allow from all

</Proxy>

ProxyPass / http://192.168.0.2/ ? ?#设置代理目标服务器及访问的目录

ProxyPassReverse / http://192.168.0.2/

ErrorLog "/log/www.test.com-error.log"

Transferlog "/log/www.test.com-access.log"

</VirtualHost>

3、重启apache服务器生效

cd /data/apache/bin

./apachectl restart

【上一篇】: 【下一篇】:

0 Comments.