gpt4 book ai didi

apache - 如何为通过 mod_proxy 连接器 (ajp) 重定向到 tomcat 的 apache 配置 https

转载 作者:行者123 更新时间:2023-11-28 22:50:38 25 4
gpt4 key购买 nike

我在 linux 系统(在 amazon aws 上)上有一个 apache 服务器,使用 https 运行。我也有一个tomcat。我想将 apache 用作 tomcat 的前门。我为 apache 启用了 mod_proxy 模块,并且重定向到 tomcat 工作正常,看起来像这样:

<VirtualHost *:80>
ServerName my.domain.com

#Log
ErrorLog /var/log/ajp.error.log
CustomLog /var/log/ajp.log combined

#AJP configuration
<Proxy *>
Order deny,allow
Deny from all
Allow from all
</Proxy>

ProxyRequests Off

ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/

</VirtualHost>

我在/etc/httpd/conf.d 文件夹中的文件 httpd.conf 的底部添加了这一行。

但是,如果我在 httpd.conf 文件中添加另一个 VirtualHost 以重定向到 https,则重定向到 https 有效,但将显示 apache 测试页面,而不是 tomcat 页面。如果我删除此重定向 VirtualHost,将显示 apache tomcat 页面。我还启用了 mod_rewrite 模块。我在 ssl.conf (/etc/httpd/conf.d/ssl.conf) 中配置的 https 内容运行良好。我在那里设置了 ssl 证书,如果客户端使用已知的 https 证书发出请求,服务器将响应该请求。否则不行。

我添加到 httpd.conf 的 https 重定向的 VirtualHost 如下所示:

    <VirtualHost *:80>
ServerName my.domain.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>

你能帮帮我吗?我在这里做错了什么?我应该在/etc/httpd/conf.d/ssl.conf 文件中进行更改吗?我很

最佳答案

好的,现在我得到了那个问题的解决方案。在 VirtualHost 结束之前,我在/etc/httpd/conf.d/ssl.conf 的底部写了这行:

#Log
ErrorLog /var/log/ajp.error.log
CustomLog /var/log/ajp.log combined

#AJP configuration
<Proxy *>
Order deny,allow
Deny from all
Allow from all
</Proxy>

ProxyRequests Off

ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/

关于apache - 如何为通过 mod_proxy 连接器 (ajp) 重定向到 tomcat 的 apache 配置 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41085765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com