apache 做反向代理服务器

编辑配置文件 httpd.conf

在虚拟主机部分

NameVirtualHost *:80

ServerAdmin webmaster@dummy-host.example.com

ServerName www.a.org

ProxyRequests Off

Order deny,allow

Allow from all

ProxyPass / http://192.168.0.115/

ProxyPassReverse / http://192.168.0.115/

 

ServerAdmin webmaster@dummy-host.example.com

ServerName www.b.org

ProxyRequests Off

Order deny,allow

Allow from all

ProxyPass / http://127.0.0.1:9000/

ProxyPassReverse / http://127.0.0.1:9000/

注:

如果不加LoadModule proxy_http_module modules/mod_proxy.so,则浏览器页面打不开,页面显示

Forbidden

You don't have permission to access / on this server.

日志acess_log里面显示

192.168.0.28 - - [03/Jun/2016:16:16:27 +0800] "GET /?sessionId=4293567494722637330&rand=1244014624405&CONTEXT=0&page=com.othe

r.AjaxWhoWhatUpdate&xrand=1244016991554&wwRandId=1244014624405&wwBugId=2341&wwType=View HTTP/1.1" 403 315

或者

192.168.0.28 - - [03/Jun/2016:17:10:32 +0800] "GET / HTTP/1.1" 403 315

即403错误

日志error_log里面显示

[Wed Jun 03 17:08:46 2009] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_p

roxy, make sure the proxy submodules are included in the configuration using LoadModule.

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注