gpt4 book ai didi

Apache SSL 配置

转载 作者:行者123 更新时间:2023-11-28 23:25:30 24 4
gpt4 key购买 nike

我们在我们的应用程序中使用 apache tomcat 7.0。我们需要配置 SSL,但我想在 tomcat 上安装 httpd apache,它将进行 ssl 加密和解密。所以可能有这样的配置?

最佳答案

是的,您可以使用 mod_proxy_http 将 HTTPS 请求代理回 Apache Tomcat 服务器的 HTTP 请求。

因此,如果您希望所有流量都通过 HTTPS 提供服务,请执行以下操作:

确保 tomcat 在端口 8080(而不是 80)上运行,安装 apache2 httpd 然后:

a2enmod proxy
a2enmod proxy_http
a2enmod ssl
a2enmod rewrite

使用以下 VirtualHost 指令创建一个名为 mysite.conf 的文件:

<VirtualHost *:443>
ServerName www.yourdomainname.com
SSLEngine on
SSLCertificateFile "/path/to/www.yourdomainname.com.cert"
SSLCertificateKeyFile "/path/to/www.yourdomainname.com.key"
ProxyPreserveHost On
ProxyPassReverse / http://localhost:8080/
</VirtualHost>

<VirtualHost *:80>
ServerName www.yourdomainname.com
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
</VirtualHost>

最后

a2ensite mysite 

关于 Apache SSL 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37809084/

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