ssl - 使用虚拟主机在 apache 服务器上设置 ssl 证书

标签 ssl apache2 debian ssl-certificate

<分区>


这个问题似乎不是关于 a specific programming problem, a software algorithm, or software tools primarily used by programmers 的.如果您认为这个问题是关于 another Stack Exchange site 的主题,您可以发表评论以说明问题可能在哪里得到解答。

关闭 9 年前

我正在尝试为我的 apache 服务器设置一个 digicert ssl 通配符证书。我对某事有点困惑。到目前为止,我有以下配置:

NameVirtualHost *:80
<VirtualHost *:80>
  ServerName x.y.com
  ServerAlias x.y.com
  DocumentRoot /webapps/x/public
  <Directory /webapps/x/public>
    Options -MultiViews
    Order deny,allow
    Allow from all
  </Directory>
  ErrorLog /var/log/apache2/y.com_error.log
  LogLevel warn
  CustomLog /var/log/apache2/y.com_access.log combined
  ServerSignature On
</VirtualHost>

NameVirtualHost *:443
<VirtualHost *:443>
  ServerName x.y.com
  ServerAlias x.y.com
  DocumentRoot /webapps/x/public
  <Directory /webapps/x/public>
    Options -MultiViews
    Order deny,allow
    Allow from all
  </Directory>
  ErrorLog /var/log/apache2/y.com_error.log
  LogLevel warn
  CustomLog /var/log/apache2/y.com_access.log combined
  ServerSignature On

  SSLEngine on
  SSLCertificateFile /etc/certificates/www_y_com.crt
  SSLCertificateKeyFile /etc/certificates/www_y_com.key
  SSLCertificateChainFile /etc/certificates/DigiCertCA.crt
  RailsEnv myenv
</VirtualHost>

但是我得到:

NameVirtualHost *:80 has no VirtualHosts (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443 no listening sockets available, shutting down

我应该如何配置才能使其正常工作?

非常感谢!

最佳答案

一眼看去,您的虚拟主机 XML 看起来是正确的。 我通常在 ports.conf 文件中写 NameVirtualHost 指令,然后每个虚拟主机必须有自己的文件。在我的系统上,它位于/etc/apache2/sites-available/your-domain-name

还有一件事。确保端口 443 在路由器中打开。我一直都忘记了这一点,并花了数小时试图弄清楚它是多么简单,就像从您的路由器配置中将端口转发 443 到您的服务器 ip 一样简单。

另外不要忘记启用网站。

# enable site
sudo a2ensite

# disable site
sudo a2dissite

关于ssl - 使用虚拟主机在 apache 服务器上设置 ssl 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17730842/

上一篇:java - 尝试使用 Google App Engine(java) 使用不受信任的证书连接到 SSL (HTTPS) 时出现异常

下一篇:Java SSL 握手失败有时会失败,具体取决于 VM 参数/属性

相关文章:

linux - 如何缩小 debian/ubuntu 上的 linux 用户空间?

python - 没有名为 _sqlite3 的模块

asp.net-mvc - 在 Asp.net MVC 应用程序中使用 SSL 与验证 key 的区别

不同域的 HTTP 和 HTTPS

C# TLS session 断开

php - 获取 服务器遇到内部错误或配置错误,无法完成您的请求

linux - 将 linux box 配置为具有静态 ip

wordpress - .htaccess 在 Wordpress 中用于 https 和 www 到非 www

ruby-on-rails - 安装 Apache Passenger,未找到 Ruby 开发 header

apache - ModSecurity规则: Which are better - GotRoot or TrustWave?