飘凌大杂烩网管技术 → apache 的http代理出错 502 Proxy Error
查看完整版本:apache 的http代理出错 502 Proxy Error
2009/1/8 22:16:56

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: Error reading from remote server


Apache/2.2.9 (Win32) PHP/5.2.6 Server at www.domain.cn Port 80

 

就这个问题Google了一下发现是mod_proxy的事,又G了一下他的文档
http://httpd.apache.org/docs/2.3/mod/mod_proxy.html
找到了这一段话
引用
For circumstances where mod_proxy is sending requests to an origin server that doesn't properly implement keepalives or HTTP/1.1, there are two environment variables that can force the request to use HTTP/1.0 with no keepalive. These are set via the SetEnv directive.
These are the force-proxy-request-1.0 and proxy-nokeepalive notes.
译了一下大概是这意思(不是我译的)
引用
当mod_proxy向一个没有正确实现持久连接(KeepAlive)或HTTP/1.1的原始服务器发送请求的时候,可以通过设置两个环境变量来发送不带持久连接(KeepAlive)的HTTP/1.0请求。这两个变量是通过SetEnv指令设置的。
以下是force-proxy-request-1.0和proxy-nokeepalive的例子:

 <Location /buggyappserver/>  

ProxyPass http://abc:7001/  

SetEnv force-proxy-request-1.0 1 

 SetEnv proxy-nokeepalive 1

</Location>

 
最后在我的httpd.conf的VirtualHost里加上了上面的两行设置
 <VirtualHost *:80> 

    JkMount /hr/servlet/* worker1  

   JkMount /hr/*.jsp worker1  

   JkMount /hr/*.do worker1   

  ServerAdmin abc@163.com  

   ServerName www.abc.com 

    ServerAlias www.abc.com.cn  

   RewriteEngine On  

   RewriteRule ^/$ /hr/ [R,P]

   SetEnv force-proxy-request-1.0.1  

   SetEnv proxy-nokeepalive 1 

</VirtualHost> 


重启apache,在拿ie5.5访问O了

 

2009/1/8 22:20:57
修改 httpd.conf
<VirtualHost  *:80>
        ServerAdmin 
asion@mail.com
        ServerName www.domain.com
        ProxyPass / http://192.168.0.92
        ProxyPassReverse  / http://192.168.0.92
        SetEnv force-proxy-request-1.0.1
        SetEnv proxy-nokeepalive 1
</virtualHost>
2009/1/8 22:21:27

mod_proxy向一个没有正确实现持久连接(KeepAlive)或HTTP/1.1的原始服务器发送请求的时候,可以通过设置两个环境变量来发送不带持久连接(KeepAlive)的HTTP/1.0请求。这两个变量是通过SetEnv指令设置的。

Powered by BBSXP 2007 ACCESS © 1998-2025
Processed in 0.01 second(s)