Apache-2.2

安裝域 SSL 不起作用

  • July 23, 2015

我有一個執行 Debian 7.5 和 Apache2 的 Linode 伺服器

我在/etc/ssl/localcerts/目錄中儲存了以下文件:

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 admin@test-site.com
 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>

首先,您需要確保啟用 SSL mod

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 admin@test-site.com
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

(第一行已更改)

引用自:https://serverfault.com/questions/707886