apache - https仅适用于site1,但site2不能在同一服务器上运行

时间:2014-02-05 20:55:00

标签: apache ssl apache2 centos

CentOS:2.6.32-358.23.2.el6.x86_64:

我在同一台服务器上有2个网站,现在我有site1.com和site2.com的SSL证书。 site1.com仅在工作,但site2.com无法运行,因为它显示site1.com

示例:我访问时

https://www.site1.com完美无缺 但是当我访问:https://www.site2.com时,它没有显示site2.com但显示像Virtualhost失败的site1.com

任何建议我在这里做错了什么?

$ cat ssl.conf
LoadModule ssl_module modules/mod_ssl.so
Listen 443
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

# Site One
<VirtualHost *:443>
  DocumentRoot "/var/www/html/site1/public"
  ServerName www.site1.com:443
   <Directory /var/www/html/site1/public>
      DirectoryIndex index.php
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
  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/httpd/conf/ssl.crt/crt1.crt
  SSLCertificateKeyFile /etc/httpd/conf/ssl.key/key1.key
  SSLCertificateChainFile /etc/httpd/conf/ca-bundle/root1.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"

</VirtualHost> 


# Site Two
<VirtualHost *:443>
  DocumentRoot "/var/www/html/site2/public"
  ServerName www.site2.com:443
   <Directory /var/www/html/site2/public>
      DirectoryIndex index.php
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
  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/httpd/conf/ssl.crt/crt2.crt
  SSLCertificateKeyFile /etc/httpd/conf/ssl.key/key2.key
  SSLCertificateChainFile /etc/httpd/conf/ca-bundle/root2.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"

</VirtualHost> 

1 个答案:

答案 0 :(得分:2)

听起来您的主配置文件中可能缺少NameVirtualHost *:443。您可以通过检查apachectl -S

的输出来检查是否正在拾取虚拟主机配置