无法让第二个 SSL 虚拟主机工作

无法让第二个 SSL 虚拟主机工作

我有一台运行 apache 2 的 Centos 5.7 服务器。该服务器默认为我的默认站点配置了 SSL。当我尝试添加另一个 SSL 虚拟主机时,无法重新启动 httpd。我尝试过 ssl.conf 中的每个不同变体,但都没有成功。这是我的 ssl.conf 文件的示例。

ssl.conf

    LoadModule ssl_module modules/mod_ssl.so

Listen 1.1.1.1:443
Listen 1.1.1.2:443
NameVirtualHost 1.1.1.1:443
NameVirtualHost 1.1.1.2: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 1.1.1.1:443>
ServerName: www.example-1.com
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
<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"
</VirtualHost>
<VirtualHost 1.1.1.2:443>
   DocumentRoot /home/path/to/directory
   ServerName www.example-2.com
   SSLEngine on
   SSLProtocol all -SSLv2
   SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
   SSLCertificateFile /etc/pki/tls/certs/example.com.crt
   SSLCertificateKeyFile /etc/pki/tls/private/example.com.key
   SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.pem
   SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

我尝试为 IP 添加 NameVirtualHost。我已确保所有文件都存在且拼写正确。我遗漏了什么?

答案1

你需要确保告诉 apache 这些是虚拟主机

NameVirtualHost 1.1.1.1:443
NameVirtualHost 1.1.1.2:443

相关内容