Apache 2.4 中第二个域名的 URL 重写之前出现证书警告

Apache 2.4 中第二个域名的 URL 重写之前出现证书警告

在将第二个域重定向到第一个主站点域的页面之前,我在浏览器上收到证书警告。单击“高级”后,重定向即可正常工作。Chrome 也发生同样的情况,显示站点不安全。证书不是通配符。

网站通过证书证明其身份。Firefox 不信任此网站,因为它使用的证书对 mysite2.ca 无效。该证书仅对以下名称有效:mysite1.ca,www.mysite1.ca 代码:SSL_ERROR_BAD_CERT_DOMAIN

请问如何解决此证书错误?这是我的主机文件。

<VirtualHost mysite1.com:80>
  ServerName mysite1.com
  ServerAdmin [email protected]

  DocumentRoot /var/www/html/mysite1/public

  <Directory "/var/www/html/mysite1/public">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Allow from all
    Require all granted
    Order allow,deny
  </Directory>

  RewriteEngine On
 
  RewriteCond %{HTTPS} off
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
  RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}

  LogLevel alert rewrite:trace3

  LogLevel debug
  ErrorLog /var/log/httpd/craft_error_log

</VirtualHost>

<VirtualHost mysite1.com:443>
  ServerName mysite1.com
  ServerAdmin [email protected]

  DocumentRoot /var/www/html/mysite1/public

  SSLEngine on
  SSLProtocol -all +TLSv1.2 +TLSv1.3

  SSLCertificateKeyFile "/usr/certs/mysite1.com.key"
  SSLCertificateChainFile "/usr/certs/mysite1.crt"
  SSLCertificateFile "/usr/certs/mysite1Certificate.crt"

  RewriteMap escape int:escape

  #Rewrite rule for mysite2.com domain

  RewriteEngine On

  RewriteCond %{HTTP_HOST} ^mysite2.com [NC,OR]
  RewriteCond %{HTTP_HOST} ^www.mysite2.com [NC]
  RewriteRule ^ https://mysite1.com/section/targetpage [L,R=301,NC]


  LogLevel alert rewrite:trace3
  <Directory "/var/www/html/mysite1/public">
     Options Indexes ExecCGI FollowSymLinks
     Order allow,deny
     Allow from all
     AllowOverride all
  </Directory>

</VirtualHost>

相关内容