Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache Debian 8-SSL证书不起作用_Apache_Ssl_Https_Debian - Fatal编程技术网

Apache Debian 8-SSL证书不起作用

Apache Debian 8-SSL证书不起作用,apache,ssl,https,debian,Apache,Ssl,Https,Debian,我最近将一个网站从我的旧web服务器123-reg.co.uk移到了一个新的Linode web服务器上,该服务器由Linode托管 我使用Debian8.9运行Apache 123 reg为我的网站提供了SSL证书,当然,当我将网站移动到新服务器时,该证书已被停用。因此,我开始在新服务器上手动重新激活证书 我能够从123 reg获得必要的SSL文件(CA捆绑包、密钥和证书),并按照Linode的说明使用以下教程在其服务器上设置SSL证书: 和 以下是站点的配置文件: <VirtualHo

我最近将一个网站从我的旧web服务器123-reg.co.uk移到了一个新的Linode web服务器上,该服务器由Linode托管

我使用Debian8.9运行Apache

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

我能够从123 reg获得必要的SSL文件(CA捆绑包、密钥和证书),并按照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>

#此处的所有文件都存在于服务器上
斯伦金安
SSLCertificateFile/etc/ssl/certs/zetec-it.com.crt
SSLCertificateKeyFile/etc/ssl/private/zetec-it.com.key
SSLCACertificateFile/etc/ssl/certs/ca-certificates.crt
服务器管理员webmaster@zetec-it.com
服务器名zetec-it.com
ServerAlias www.zetec-it.com
DirectoryIndex.html index.php
DocumentRoot/var/www/html/zetec-it.com/public_html
日志级别警告
ErrorLog/var/www/html/zetec-it.com/log/error.log
CustomLog/var/www/html/zetec-it.com/log/access.log
设置似乎是合法的,但当我试图通过
https
访问网站时,浏览器会声明连接不安全


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

您需要一个在端口443上侦听的
VirtualHost
,以便使用HTTPS。您已将
VirtualHost
配置为在启用
SSLEngine的同时在端口80上侦听

为了使https正常工作,您只需将
更改为
。 一旦您这样做了,您就不会有处理到的http连接的配置(不会有任何
VirtualHost
等待连接到
ServerName zetec it.com

通常有多种方法可以为请求相同主机名的http连接提供服务:

  • 您可以使用如下方式将它们重定向到https(使用
    mod_rewrite
    重定向到相同的路径):

    服务器名zetec-it.com ServerAlias www.zetec-it.com 重新启动发动机 重写规则^https://zetec-it.com%{REQUEST_URI}[END,NE,R=permanent]
  • 您也可以通过http交付相同的内容

    <VirtualHost *:80> # All of the files here exist on the server 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> #此处的所有文件都存在于服务器上 服务器管理员webmaster@zetec-it.com 服务器名zetec-it.com ServerAlias www.zetec-it.com DirectoryIndex.html index.php DocumentRoot/var/www/html/zetec-it.com/public_html 日志级别警告 ErrorLog/var/www/html/zetec-it.com/log/error.log CustomLog/var/www/html/zetec-it.com/log/access.log
  • 无论哪种方式,您都需要两个配置文件,一个是https(这基本上是上面的示例,请记住将80替换为443),另一个是http,我为您提供了两个示例。
    您可以将它们放入单独的文件中,记住在这种情况下激活它们。

    您正在将SSL连接绑定到端口80。你们应该使用443端口。@JonasSchwabe你们是我的上帝英雄,我可以吻你们@JonasSchwabe很奇怪,这样做导致我的站点重定向到我服务器上托管的另一个站点,你知道为什么吗?@JonasSchwabe我需要包括两个端口,即
    ?你需要两个多主机,一个用于HTTP,一个用于HTTPS。将此vhost切换到端口443时,没有任何虚拟主机用于与此域的http连接。执行重定向的默认vhost可能处于活动状态。您可以将http vhost重定向到https,也可以复制vhost并对80和443进行相同的设置。 <VirtualHost *:80> # All of the files here exist on the server 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>