尝试使用SSL的Apache 2,我得到一个“无效的命令”—– BEGIN“,在我的.CRT

我经历了这个教程http://www.vanemery.com/Linux/Apache/apache-SSL.html在Apache2上设置我的SSL。 但是,当我尝试启动我的服务器时,我得到这个错误:

/etc/apache2/conf.d/ssl.crt/foo-server.crt的第一行的语法错误:无效的命令'—– BEGIN',可能是拼错的或由未包含在服务器configuration中的模块定义的

在我的Apache安装程序中看起来缺less什么? 我如何检查?

非常感谢!

= – = – = – = – = – = – = – = – = – = – = – = – = – = – =

下面是我的虚拟主机文件:

<IfModule mod_ssl.c> <VirtualHost *:443> ServerName foo.ca ServerAlias www.foo.ca RailsEnv development DocumentRoot /home/dan/rails/foo/public SSLEngine On SSLCipherSuite HIGH:MEDIUM SSLProtocol all -SSLv2 SSLCertificateFile /etc/apache2/conf.d/ssl.crt/foo-server.crt SSLCertificateKeyFile /etc/apache2/conf.d/ssl.key/foo-server.key SSLCertificateChainFile /etc/apache2/conf.d/ssl.crt/foo-ca.crt SSLCertificateFile /etc/apache2/conf.d/ssl.crt/foo-ca.crt <Directory "/home/dan/rails/foo/public"> Order allow,deny Allow from all </Directory> </VirtualHost> </IfModule> 

检查你的include指令。 看来httpd试图运行你的证书文件,就好像它是一个configuration文件一样。 因此,证书文件开始处的“—开始RSA密钥”就像一个(无效的)命令一样处理。 在你的主httpd.conf文件中,我打赌你的include是这样的: Include conf.d/ssl.crt/*当它应该更像这样: Include conf.d/ssl.crt/*.confInclude conf.d/*.conf

Include用于为其他httpd模块提供所有其他configuration文件。 其中之一是ssl.conf。 但是,您不希望这些密钥被视为configuration文件,否则您会看到您所看到的错误。