apache - 在一个ip和一个端口上服务多个域

标签 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>

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

谢谢。

最佳答案

就我而言,它工作正常。

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>

关于apache - 在一个ip和一个端口上服务多个域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34653514/

相关文章:

apache - 为什么我会收到重定向循环?

php - 如何在共享主机的子文件夹中安装 laravel 应用程序?

android - 如何获取 https 的 InputStream,分块 Push Servlet?

ssl - Meteor - 如何使用 POST 请求为 Meteor 中的 *client* 身份验证提交 SSL 证书?

PHP Curl(带 NSS)在连接到 https 时可能使用 SSLv3 而不是 TLS

tomcat - nginx (https) 到 tomcat (https)

python - Django/Apache 错误 "attempt to write a readonly database"

php - .htaccess 未重定向/to/index.php

php - GMAIL imap_open 远程规范无效 (errflg=2)

java - 如何用公共(public) CA 机构签署的服务器公共(public)证书解决 "unable to find valid certification path to requested target"?