大网数据广告活动
网站运营与故障问答

500 internal server error when trying to implement reverse proxy under Apache. How do I forward the requests to another server without errors?

· 52CE 我爱测

I want to forward a request from one server to another. Here is my problem: hr.example.com - port 80 - Server A support.example.com - port 80 - Server B All requests on port 80 are forwarded to Server A by the firewall. So, I wan…

问题原文

原帖链接 · wouter205 · CC BY-SA 4.0

I want to forward a request from one server to another. Here is my problem:

  • hr.example.com - port 80 - Server A
  • support.example.com - port 80 - Server B

All requests on port 80 are forwarded to Server A by the firewall.

So, I want requests for support.example.com to be forwarded from server A to server B. How can I achieve this with Apache?

I followed the answer from here. I added the following code to my apache.conf on Server A but it results in a "500 internal server error".

<VirtualHost *:80>
  ServerName support.example.com    
  LoadModule proxy_module modules/mod_proxy.so    
  ProxyRequests Off
  <Proxy *>
     Require all granted
  </Proxy>    
  ProxyPass / http://IP-ADDRESS-SERVER-B:80/
  ProxyPassReverse / http://IP-ADDRESS-SERVER-B:80/
  <Location />
     Require all granted
   </Location>    
</VirtualHost>

Note: Server A is Windows server 2012 with Apache 2.4

How should I forward these requests properly please?

已采纳解答

原帖链接 · wouter205 · CC BY-SA 4.0

Thanks @MrWhite for giving the correct configuration. I needed extra module mod_proxy_http and to change the IP adress of server-B to the hostname as I have multiple vHosts on :80. Here is the working configuration:

<VirtualHost *:80>
support.example.com 
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so


 ProxyRequests Off
    <Proxy *>
     Require all granted
    </Proxy>

  ProxyPass / http://support.example.com:80/
   ProxyPassReverse / http://support.example.com:80/
  <Location />
       Require all granted
   </Location>


</VirtualHost>

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2018-05-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。