我有一台运行 Debian 7.5 和 Apache2 的 Linode 服务器
我在目录中存储了以下文件/etc/ssl/localcerts/
:
- www.test-site.com.key
- www.test-site.com.csr
- www.test-site.com.crt
- 中间件.crt
test-site.com.conf
我在目录中的文件中具有以下配置/etc/apache2/sites-enabled/
:
<VirtualHost *:80>
SSLEngine On
SSLCertificateFile /etc/ssl/localcerts/www.test-site.com.crt
SSLCertificateKeyFile /etc/ssl/localcerts/www.test-site.com.key
SSLCertificateChainFile /etc/ssl/localcerts/intermediate.crt
#SSLCACertificateFile /etc/ssl/localcerts/ca.pem
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName www.test-site.com
# ServerAlias test-site.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/user/public/test-site.com/public/
# Log file locations
LogLevel warn
ErrorLog /home/user/public/test-site.com/log/error.log
CustomLog /home/user/public/test-site.com/log/access.log combined
</VirtualHost>
有人能找出我做错的地方吗?我认为所有文件都设置正确。但 SSL 安装似乎仍然不起作用。
更新
下面是描述连接的图像:
ports.conf
以下是目录中的内容/etc/apache2/
:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
NameVirtualHost *:443
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
NameVirtualHost *:443
Listen 443
</IfModule>
答案1
首先你需要确保 SSL 模式已启用
a2enmod ssl
那么您需要将您的配置更改为如下内容:
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/localcerts/www.test-site.com.crt
SSLCertificateKeyFile /etc/ssl/localcerts/www.test-site.com.key
SSLCertificateChainFile /etc/ssl/localcerts/intermediate.crt
#SSLCACertificateFile /etc/ssl/localcerts/ca.pem
# Admin email, Server Name (domain name), and any aliases
ServerAdmin [email protected]
ServerName www.test-site.com
# ServerAlias test-site.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/user/public/test-site.com/public/
# Log file locations
LogLevel warn
ErrorLog /home/user/public/test-site.com/log/error.log
CustomLog /home/user/public/test-site.com/log/access.log combined
(第一行已更改)