在一个IP和一个端口上提供多个域

时间:2016-01-07 11:03:11

标签: apache ssl https virtualhost multiple-domains

我想在CentOS服务器上提供多个域名。 我在http上运行服务器。 现在我想在https上运行这些服务器。

我这样写了ssl.conf。

Listen 443
<VirtualHost *:443>
  SSLEngine on
  SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
  SSLCertificateFile /etc/httpd/ssl/apache.crt
  SSLCertificateKeyFile /etc/httpd/ssl/apache.key
  SSLCertificateChainFile /etc/httpd/ssl/ca.crt
  ServerName example.com:443
  DocumentRoot "/var/www/html"
</VirtualHost>
<VirtualHost *:443>
  SSLEngine on
  SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
  SSLCertificateFile /etc/httpd/ssl/two.crt
  SSLCertificateKeyFile /etc/httpd/ssl/two.key
  SSLCertificateChainFile /etc/httpd/ssl/ca.crt
  ServerName two.example.com:443
  DocumentRoot /var/www/html/two
</VirtualHost>

但它不起作用。 我该怎么办?

感谢。

1 个答案:

答案 0 :(得分:0)

就我而言,它运作良好。

Listen 443
<VirtualHost *:443>
  SSLEngine on
  SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
  SSLCertificateFile /etc/httpd/ssl/apache.crt
  SSLCertificateKeyFile /etc/httpd/ssl/apache.key
  SSLCertificateChainFile /etc/httpd/ssl/ca.crt
  ServerName example.com:443
  DocumentRoot "/var/www/html"
</VirtualHost>
<VirtualHost *:443>
  DocumentRoot /var/www/html/two
  ServerName two.example.com
</VirtualHost>