gpt4 book ai didi

Apache 提供了错误的 SSL-Cert

转载 作者:太空宇宙 更新时间:2023-11-03 14:54:22 26 4
gpt4 key购买 nike

我有一台运行 Debian 8.1、Apache 2.4.10 和 OpenSSL 1.0.1k 的服务器。我有一个域 example.com,其中包含几个子域,例如 www.example.com、cloud.example.com 和 db.example.com,它们都指向服务器(A 记录)。所有这些子域都有自己的虚拟主机和自己的 SSL 证书。此外,如果您使用另一个域或 IP 发送 HTTPS 请求,您将获得一个带有自签名证书的页面。在我重新启动服务器之前,一切都运行得很完美。现在,当我请求 example.com(没有子域前缀)时,我得到了自签名的 crt。子域工作得很好。我有以下 vHost-Configs:

(因为我只想要 HTTPS,所以我有一个针对所有 HTTP 连接的重写规则)

000-default.conf

<VirtualHost *:80>
ServerAdmin admin@example.com
RewriteEngine On
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@example.com
DocumentRoot /var/www

<Directory /var/www>
AllowOverride All
Require all granted
</Directory>

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
ErrorLog ${APACHE_LOG_DIR}/error.ssl.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.ssl.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/default/ca.crt
SSLCertificateKeyFile /etc/ssl/certs/default/ca.key
</VirtualHost>
</IfModule>

www.example.com.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@example.com
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example
<Directory /var/www/example>
AllowOverride All
Require all granted
</Directory>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
ErrorLog ${APACHE_LOG_DIR}/error.ssl.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.ssl.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/www.example.com/ca.crt
SSLCertificateKeyFile /etc/ssl/certs/www.example.com/ca.key
SSLCertificateChainFile /etc/ssl/certs/www.example.com/sub.class1.server.ca.pem
SSLCACertificateFile /etc/ssl/certs/www.example.com/ca.pem
</VirtualHost>
</IfModule>

cloud.example.com.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@example.com
ServerName cloud.example.com
DocumentRoot /var/www/example
<Directory /var/www/example>
AllowOverride All
Require all granted
</Directory>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
ErrorLog ${APACHE_LOG_DIR}/error.ssl.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.ssl.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/www.example.com/ca.crt
SSLCertificateKeyFile /etc/ssl/certs/www.example.com/ca.key
SSLCertificateChainFile /etc/ssl/certs/www.example.com/sub.class1.server.ca.pem
SSLCACertificateFile /etc/ssl/certs/www.example.com/ca.pem
</VirtualHost>
</IfModule>

我真的希望有人能帮助我!

最佳答案

主机名是示例(类似于域,但没有 .com)所以我将主机名更改为一些随机输入,并且在重新启动后一切再次正常工作。当我改回我的主机名时,它甚至在重新启动后仍能正常工作。

关于Apache 提供了错误的 SSL-Cert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31060744/

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