我收到此错误service apache2 restart
Error: SSLCertificateFile: file '/etc/apache2/ssl/www_example_com.crt' does not exist or is empty
我正在尝试使用 LAMP 在 ubuntu ec2 实例上配置 comodo ssl 证书,并已按照以下链接执行了所有官方步骤。
https://help.ubuntu.com/community/ApacheMySQLPHP
https://help.ubuntu.com/14.04/serverguide/httpd.html#https-configuration
请帮忙。
答案1
您应该检查以下内容:
- 该证书确实存在于该地点。
- 证书不为空。
完成后,您可以尝试检查您的站点的virtual host
文件。
该文件夹中/etc/apache2
有sites-enabled
一个文件夹,该文件夹包含该virtual hosts
文件作为与sites-available
文件夹的符号链接。
您不能在 sites-available
或sites-enabled
文件夹中检查虚拟主机文件。
正确的形式应该是:
<VirtualHost IP ADDRESS :443 >
DocumentRoot <path/to/sites/folder>
ServerName <domain name>
SSLEngine on
SSLCertificateFile /etc/ssl/crt/primary.crt #edit path as needed
SSLCertificateKeyFile /etc/ssl/crt/private.key #edit path as needed
SSLCertificateChainFile /etc/ssl/crt/intermediate.crt #edit path as needed
#Include /etc/options-ssl-apache.conf #optional for some configs
</VirtualHost>
当然 :更改文件和路径的名称以匹配您的证书文件:
SSLCertificateFile should be your primary certificate file for your domain name.
SSLCertificateKeyFile should be the key file generated when you created the Certificate signing reques.
SSLCertificateChainFile should be the intermediate certificate file (if any) that was supplied by your certificate authority.
进行适当更改后,保存更改并退出文本编辑器。使用以下命令之一重新启动 Apache Web 服务器:
/usr/local/apache/bin/apachectl startssl
/usr/local/apache/bin/apachectl restart
答案2
我收到此错误是因为
SSLCertificateFile /etc/apache2/ssl/www.example.com.pem;
SSLCertificateKeyFile /etc/apache2/ssl/www.pdchealthcare.com.pem;
替换为
SSLCertificateFile /etc/apache2/ssl/www.example.com.pem
SSLCertificateKeyFile /etc/apache2/ssl/www.example.com.pem
错误消失了(请注意;已被删除)并且我可以重新启动 Apache 服务器。