大网数据广告活动
服务器运维问答

Why am I getting an "Invalid command 'ProxyPass'" error when I start my Apache 2.2 server?

· 52CE 我爱测

I'm having trouble getting Proxying working in Apache 2.2 When I try to start it, I get an Invalid command 'ProxyPass' error. that would be indicative of proxy_http_module not being loaded. However when I look at the debug, it se…

问题原文

原帖链接 · BIBD · CC BY-SA 3.0

I'm having trouble getting Proxying working in Apache 2.2

When I try to start it, I get an Invalid command 'ProxyPass' error. that would be indicative of proxy_http_module not being loaded. However when I look at the debug, it seems to be there. e.g.,

E:\Apache\bin>httpd -e debug
[Fri Aug 21 15:48:55 2015] [debug] mod_so.c(246): loaded module actions_module
...
[Fri Aug 21 15:48:55 2015] [debug] mod_so.c(246): loaded module proxy_ajp_module
[Fri Aug 21 15:48:55 2015] [debug] mod_so.c(246): loaded module proxy_http_module   <-----
[Fri Aug 21 15:48:55 2015] [debug] mod_so.c(246): loaded module setenvif_module
....
[Fri Aug 21 15:48:55 2015] [debug] mod_so.c(246): loaded module jk_module
[Fri Aug 21 15:48:55 2015] [notice] Disabled use of AcceptEx() WinSock2 API
Syntax error on line 84 of E:/Apache/conf/extra/httpd-ssl.conf:
Invalid command 'ProxyPass', perhaps misspelled or defined by a module not included
in the server configuration

So it looks to me that proxy_http_module is loading. I don't understand why it doesn't know what ProxyPass is.

I've certainly turned it on in my httpd.conf file

#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.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     # <--------------
#LoadModule rewrite_module modules/mod_rewrite.so

Note: I am trying to do this through an SSL connection so I'm loading httpd-ssl.conf as well later on in my httpd.conf file

<IfModule ssl_module>
Include conf/extra/httpd-ssl.conf
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Then in httpd-ssl.conf I've set up a VirtualHost entry

<VirtualHost _default_:443>
    DocumentRoot "E:/Apache/htdocs"
### dummy IP
    ServerName 127.12.34.56:443
    ServerAdmin [email omitted]
    ErrorLog "E:/Apache/logs/error.log"
    TransferLog "E:/Apache/logs/access.log"

    #ProxyRequests Off
### It chokes on the following entry
    ProxyPass / http://myfirewalledserver:80/
    #ProxyPassReverse / http://myfirewalledserver:80/
</VirtualHost>                                  

What have I missed here?

已采纳解答

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

proxy_http module requires proxy, and ProxyPass directive is defined in the latter.

Make sure it's also loaded.

Thanks to Milind Singh

Load the module by running

Run sudo a2enmod proxy_http

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

资料来源与适用范围

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

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

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