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

Trouble debugging self-signed SSL cert for Apache

· 52CE 我爱测

I'm trying to setup a self-signed SSL cert so I can develop my app with SSL (so I can finally get my sites running with SSL...). I've created a Angular site with a headless API (Lumen), and tried to setup a multi-domain SSL cert …

问题原文

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

I'm trying to setup a self-signed SSL cert so I can develop my app with SSL (so I can finally get my sites running with SSL...). I've created a Angular site with a headless API (Lumen), and tried to setup a multi-domain SSL cert using a question from ServerFault:

How to create a multi-domain self-signed certificate for Apache2?

The test command checked out, so I tried installing the cert with the following Apache config:

<VirtualHost *:80>
        ServerAdmin [email omitted]
        ServerName api.gamersplane.local
        DocumentRoot /var/www/GamersPlane.api/public
        <Directory /var/www/GamersPlane.api/public/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        ErrorLog "|/usr/bin/cronolog /var/log/gamersplane/%Y/%m/%d/error.log"

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel notice

        CustomLog ${APACHE_LOG_DIR}/gamersplane/access.log combined

        SSLEngine on
        SSLCertificateFile /var/www/GamersPlane.api/ssl/gamersplane.local.pem
        SSLCertificateKeyFile /var/www/GamersPlane.api/ssl/gamersplane.local.key
</VirtualHost>

Unfortunately, when I hit my site, I get This site can’t provide a secure connection. I tried googling for this, but everything seems specific to certain sites/configs, and I can't figure out how to debug what's wrong.

I setup the Apache config via a Digital Ocean guide, which also recommended these configs, which I wasn't sure about. I tried with and without them, no luck:

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
</Directory>

I'd love assistance on understanding how to debug/resolve these sorts of issues.

已采纳解答

原帖链接 · Mircea Vutcovici · CC BY-SA 3.0

You need to configure another apache VirtualHost and a Listen on port 443.

See: https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html

And I wouldn't use self signed certificates even for development when you can have certificates signed by a public certificate authority for free from https://letsencrypt.org/

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

资料来源与适用范围

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

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

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