繁体   English   中英

Debian 8-SSL证书不起作用

[英]Debian 8 - SSL Certificate is not working

我最近将网站从旧的Web服务器123-reg.co.uk移到了由Linode托管的新的Linode Web服务器。

我在Debian 8.9上运行Apache。

123-reg为我提供了网站的SSL证书,当我将网站移至新服务器时,该证书当然已停用。 因此,我设置为手动在新服务器上重新激活证书。

我能够从123-reg中获取必要的SSL文件(CA Bundle,密钥和证书),并按照以下教程使用Linode的指示在其服务器上设置SSL证书:

第一教程第二教程

这是站点的配置文件:

<VirtualHost *:80>
  # All of the files here exist on the server
  SSLEngine On
  SSLCertificateFile /etc/ssl/certs/zetec-it.com.crt
  SSLCertificateKeyFile /etc/ssl/private/zetec-it.com.key
  SSLCACertificateFile /etc/ssl/certs/ca-certificates.crt

  ServerAdmin webmaster@zetec-it.com
  ServerName  zetec-it.com
  ServerAlias www.zetec-it.com

  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/zetec-it.com/public_html
  LogLevel warn
  ErrorLog  /var/www/html/zetec-it.com/log/error.log
  CustomLog /var/www/html/zetec-it.com/log/access.log combined
</VirtualHost>

该设置似乎合法,但是当我尝试通过https访问该网站时,浏览器指出连接不安全。

我是服务器管理员的新手。 有没有人有任何建议或潜在的解决方案?

您需要一个正在侦听端口443的VirtualHost才能使用有效的HTTPS。 您已将VirtualHost配置为在SSLEngine On上侦听端口80。

为了使https工作,您只需将<VirtualHost *:80>更改为<VirtualHost *:443> 完成此操作后,您将没有处理HTTP连接的配置(不会有任何VirtualHost等待ServerName zetec-it.com连接)。

通常,有几种方法可以服务于请求相同主机名的http连接:

  1. 您可以使用以下方式将它们重定向到https(使用mod_rewrite来重定向到同一路径):

    \n <VirtualHost *:80>\n   服务器名称zetec-it.com\n   ServerAlias www.zetec-it.com\n\n   在RewriteEngine上\n   RewriteRule ^ https://zetec-it.com% {REQUEST_URI} [END,NE,R =永久]\n </虚拟主机>\n
  2. 您也通过http传递相同的内容

    \n <VirtualHost *:80>\n   #此处所有文件都存在于服务器上\n   ServerAdmin webmaster@zetec-it.com\n   服务器名称zetec-it.com\n   ServerAlias www.zetec-it.com\n\n   DirectoryIndex index.html index.php\n   DocumentRoot /var/www/html/zetec-it.com/public_html\n   LogLevel警告\n   错误日志/var/www/html/zetec-it.com/log/error.log\n   CustomLog /var/www/html/zetec-it.com/log/access.log组合\n </虚拟主机>\n

无论哪种方式,您都需要两个配置文件,一个是https(这基本上是您的示例,请记住用443替换80),另一个是http,我为您提供了2个示例。 您可以将它们放入单独的文件中,请记住在这种情况下将其激活。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM