大网数据广告活动
服务器运维问答

"Server should be SSL-aware but has no certificate configured"

· 52CE 我爱测

Ubuntu 14.04 Apache 2.4.7 w/mod_ssl I'm trying to install a (single) domain certificate. For some reason, apache does not accept it and refuses to start if the related website is enabled. Despite heavy googling, I can't make sens…

问题原文

原帖链接 · pixeline · CC BY-SA 3.0

Ubuntu 14.04 Apache 2.4.7 w/mod_ssl

I'm trying to install a (single) domain certificate. For some reason, apache does not accept it and refuses to start if the related website is enabled. Despite heavy googling, I can't make sense of the error messages. Why does it says that there are no certificate configured? It's set in the virtualhost, and it points to the crt file in the right location.

Error_log

[Tue May 19 18:11:08.123857 2015] [ssl:emerg] [pid 10040:tid 140146576725888] AH02240: Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] ((null):0)
[Tue May 19 18:11:08.123894 2015] [ssl:emerg] [pid 10040:tid 140146576725888] AH02312: Fatal error initialising mod_ssl, exiting.

What I have tried:

  • doublechecked virtualhost syntax and path to certificate and key
  • doublechecked certificate are chmoded 644 and key is chmoded 600
  • doublechecked certificate is valid. Redownloaded from my provider. Opened it in editor

Here is the virtualhost

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerName www.domain.tld
        RedirectMatch (.*) https://domain.tld$1
    </VirtualHost>

    <VirtualHost _default_:443>
        ServerAdmin admin@localhost
        ServerName domain.tld
        DocumentRoot /home/user/www/domain.tld/public

        # SSL CERTIFICATES

        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/domain.tld.crt
        SSLCertificateKeyFile /etc/ssl/private/domain.tld.key
        SSLCertificateChainFile /etc/ssl/certs/GandiStandardSSLCA2.pem
        SSLVerifyClient None
        # SSLProtocol all -SSLv2 -SSLv3

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                        SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                        SSLOptions +StdEnvVars
        </Directory>
        BrowserMatch "MSIE [2-6]" \
                        nokeepalive ssl-unclean-shutdown \
                        downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown


        <Directory /home/user/www/domain.tld/public>
            Require all granted
        </Directory>

        LogLevel error
        ErrorLog ${APACHE_LOG_DIR}/user-eu-error.log
        CustomLog ${APACHE_LOG_DIR}/user-eu-access.log combined

        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/home/user/www/domain.tld/public/$1

        ErrorDocument 404 /missing.php

        # Mod_status
        <location /server-status> 
            SetHandler server-status 
            Order Allow,Deny
            Allow from all
        </location>
    </VirtualHost>
</IfModule>

Any suggestion as to what could be wrong?

已采纳解答

原帖链接 · Machavity · CC BY-SA 3.0

I think eltrai is on the right path but I would remove the first <VirtualHost> block and use ServerAlias in the second

<VirtualHost _default_:443>
    ServerAdmin admin@localhost
    ServerName domain.tld
    ServerAlias www.domain.tld

You can add your RedirectMatch later in that same block to redirect from www to non.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-05-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。