Apache2 无法启动 - 错误无效命令‘ProxyRequests’

Apache2 无法启动 - 错误无效命令‘ProxyRequests’

我希望得到一些关于我遇到的以下问题的指导。当我尝试启动我的 apache2 服务器时,我收到以下错误。

user@kali:~# service apache2 start
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

这就是我接下来要做的事情。

user@kali:~# journalctl | tail
Jan 21 01:19:32 kali pulseaudio[839]: E: [alsa-sink-ES1371/1] alsa-sink.c: Most likely this is a bug in the ALSA driver 'snd_ens1371'. Please report this issue to the ALSA developers.
Jan 21 01:19:32 kali pulseaudio[839]: E: [alsa-sink-ES1371/1] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
Jan 21 01:19:35 kali systemd[1]: Starting The Apache HTTP Server...
Jan 21 01:19:35 kali apachectl[1355]: AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled/ajp.conf:
Jan 21 01:19:35 kali apachectl[1355]: Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server configuration
Jan 21 01:19:35 kali apachectl[1355]: Action 'start' failed.
Jan 21 01:19:35 kali apachectl[1355]: The Apache error log may have more information.
Jan 21 01:19:35 kali systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 21 01:19:35 kali systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 21 01:19:35 kali systemd[1]: Failed to start The Apache HTTP Server.

我拉出 ajp.conf 文件,它显示的内容如下。

ProxyRequests Off
# Only allow localhost to proxy requests
<Proxy *>
Order deny,allow
Deny from all
Allow from localhost
</Proxy>
# Change the IP address in the below lines to the remote servers IP address hosting the Tomcat instance
ProxyPass                 / ajp://**.**.*.***:8009/
ProxyPassReverse    / ajp://**.**.*.***:8009/

答案1

我也遇到了这个问题。 Invalid command 'ProxyPass', perhaps misspelled or defined by a module not included in the server configuration 我正在使用这些命令来启用 apache mods

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
sudo a2enmod proxy_balancer
sudo a2enmod proxy_connect
sudo a2enmod proxy_html

最后运行此命令来重新启动 apache。

sudo systemctl restart apache2

答案2

我希望就我遇到的以下问题获得一些指导。

错误信息中给出了答案:

无效命令‘ProxyRequests’,可能是拼写错误或由服务器配置中未包含的模块定义

ProxyRequests没有拼写错误,所以可能你没有加载modules/mod_proxy.so

httpd.conf变革:

#LoadModule proxy_module modules/mod_proxy.so

到:

LoadModule proxy_module modules/mod_proxy.so

相关内容