![Linux 上的 Apache 具有两个真实证书(.com 和 .co.uk)](https://linux22.com/image/578262/Linux%20%E4%B8%8A%E7%9A%84%20Apache%20%E5%85%B7%E6%9C%89%E4%B8%A4%E4%B8%AA%E7%9C%9F%E5%AE%9E%E8%AF%81%E4%B9%A6%EF%BC%88.com%20%E5%92%8C%20.co.uk%EF%BC%89.png)
我只能配置一个。当我尝试配置另一个时,我收到带有错误语法的 httpd 错误。有人知道如何在 apache 中配置 2 个证书吗?这是我所拥有的:
# ssl
LoadModule ssl_module modules/mod_ssl.so
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
SSLPassPhraseDialog builtin
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
<VirtualHost *:443>
ServerName company ip address
ServerAlias *.company wild card certificate
DocumentRoot /live/html
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
RewriteEngine on
RewriteOptions Inherit
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
### SSLCertificateFile /etc/httpd/pki/company.co.uk.crt
### SSLCertificateKeyFile /etc/httpd/pki/server.key
### SSLCACertificateFile /etc/httpd/pki/intermediate.crt
SSLCertificateFile /etc/httpd/pki/USA/server.crt
SSLCertificateKeyFile /etc/httpd/pki/USA/server.key
SSLCACertificateFile /etc/httpd/pki/USA/intermediate.crt
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
答案1
您需要定义一个 IP/证书。每个 IP 只能使用一个证书。因此,您应该在虚拟主机中使用 IP,而不是 *:443。