我已经在我的服务器上安装了 httpd 和 tomcat,但不知何故我无法连接它们。
<VirtualHost *:80>
ServerName www.harshrathod.dev
ServerAlias harshrathod.dev
ServerAdmin ******************
DocumentRoot /var/www/html
DirectoryIndex index.html
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.harshrathod.dev [OR]
RewriteCond %{SERVER_NAME} =harshrathod.dev
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ProxyRequests off
ProxyPass /projects/legend ajp://localhost:8009/legend
ProxyPassReverse /projects/legend ajp://localhost:8009/legend
</VirtualHost>
访问harhrathod.dev 上的图例页面显示错误,而不是响应“../webapps/legend”中的index.jsp 页面。两台服务器都已启动并正在运行。HTTPD 在 localhost:8080 上侦听 80 和 tomcat
我需要将其粘贴到:
ProxyRequests off
ProxyPass /projects/legend ajp://localhost:8009/legend
ProxyPassReverse /projects/legend ajp://localhost:8009/legend
在 httpd-le-ssl.conf 中?
error_log 上有这些与代理相关的错误
[Sun Mar 29 17:13:28.909192 2020] [proxy:error] [pid 6690] (70007)The timeout specified has expired: AH00957: AJP: attempt to connect to 120.0.0.1:8009 (120.0.0.1) failed
[Sun Mar 29 17:13:28.909285 2020] [proxy_ajp:error] [pid 6690] [client 27.56.193.67:10405] AH00896: failed to make connection to backend: 120.0.0.1, referer: https://harshrathod.dev/
[Sun Mar 29 17:18:19.513513 2020] [proxy:error] [pid 6659] (70007)The timeout specified has expired: AH00957: AJP: attempt to connect to 120.0.0.1:8009 (120.0.0.1) failed
[Sun Mar 29 17:18:19.513582 2020] [proxy_ajp:error] [pid 6659] [client 103.125.234.198:57195] AH00896: failed to make connection to backend: 120.0.0.1, referer: https://harshrathod.dev/
您
<VirtualHost *:80>
设置为将所有内容重定向到端口443
(至少对于harshrathod.dev
andwww.harshrathod.dev
域),因此该ProxyPass
指令将永远不会被执行。正如您在问题中建议的那样,您应该将
ProxyPass
和相关指令移至您的<VirtualHost *:443>
.另请注意,此配置中未使用Tomcat 的
HTTP/1.1
<Connector>
on 端口。8080
您改用AJP/1.3
<Connector>
on 端口8009
,这是一个更快的协议。如果您想使用(较慢)HTTP/1.1
<Connector>
使用: