Apache2 未启动 - 错误无效命令“ProxyRequests”

dfr*_*202 6 linux apache-http-server ubuntu

我希望就我遇到的以下问题获得一些指导。当我尝试启动我的 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.
Run Code Online (Sandbox Code Playgroud)

所以这就是我接下来要做的。

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.
Run Code Online (Sandbox Code Playgroud)

我调出 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/
Run Code Online (Sandbox Code Playgroud)

Dav*_*ill 5

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

答案由错误消息指示:

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

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

httpd.conf,改变:

#LoadModule proxy_module modules/mod_proxy.so
Run Code Online (Sandbox Code Playgroud)

到:

LoadModule proxy_module modules/mod_proxy.so
Run Code Online (Sandbox Code Playgroud)


Toi*_*oir 5

我也有这个问题。 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
Run Code Online (Sandbox Code Playgroud)

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

sudo systemctl restart apache2
Run Code Online (Sandbox Code Playgroud)