SSL证书和Apache虚拟主机

时间:2016-07-03 15:54:15

标签: apache ssl virtual-hosts

我的ubuntu服务器设置遇到了一个非常奇怪的问题。我正在使用LAMP堆栈运行一些网站。

其中一个网站有专用的ip和comodo ssl证书。其他网站使用共享IP并使用let'sencrypt ssl证书。

以下是专用IP上网站的虚拟主机配置:

# domain: example.com
# public: /home/myhomefolder/public/example.com/

<VirtualHost actual_dedicated_ip:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin admin@example.com
  ServerName  www.example.com
  ServerAlias example.com
  Redirect permanent / https://www.example.com/
  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/myhomefolder/public/example.com/public

  # Log file locations
  LogLevel warn
  ErrorLog  /home/myhomefolder/public/example.com/log/error.log
  CustomLog /home/myhomefolder/public/example.com/log/access.log combined
</VirtualHost>
<VirtualHost actual_dedicated_ip:443>
     SSLEngine On
     SSLProtocol ALL -SSLv2 -SSLv3
     SSLHonorCipherOrder On
     SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
     SSLCertificateFile /etc/apache2/ssl/www.example.com.crt
     SSLCertificateKeyFile /etc/apache2/ssl/www.example.com.key
     SSLCertificateChainFile /etc/apache2/ssl/www.example.com.ca-bundle
     <Directory /home/myhomefolder/public/example.com/public>
       Require all granted
       AllowOverride ALL
     </Directory>     
     ServerAdmin admin@example.com
     ServerName example.com
     DocumentRoot /home/myhomefolder/public/example.com/public
     ErrorLog /home/myhomefolder/public/example.com/log/https_error.log
     CustomLog /home/myhomefolder/public/example.com/log/https_access.log combined
</VirtualHost>

一切正常,除了在特定的网络上(到目前为止,我只能在连接到Verizon LTE时在我的iphone上重现这个,但在连接到wifi时没有)我得到一个错误说“Safari无法打开页面,因为发生了太多的重定向“或者我收到”无法验证服务器身份“的提示,并且证书详细信息适用于同一主机上的其他网站但不同的IP。

可能导致这种情况的任何想法?

1 个答案:

答案 0 :(得分:1)

所以我终于到底了。看起来verizon正在使用ipv6而我的vhost只有ipv4配置。一旦我在我的虚拟主机中添加了我的ipv6 ip,问题就消失了。