Trying Apache 2 with SSL, I'm getting an "Invalid command '-----BEGIN', on my .CRT

7,288

Check your include directive. It appears httpd is trying to run your certificate file as if it was a configuration file. So the "---begin RSA key" at the start of certificate file is getting handled like an (invalid) command. In your main httpd.conf file, I'm betting your include is something like this: Include conf.d/ssl.crt/* when it should be more like this: Include conf.d/ssl.crt/*.conf or Include conf.d/*.conf

Include is used to pull in all the additional configuration files for other httpd modules. One of which is ssl.conf. However, you don't want those keys to be treated like config files, else you get the error you're seeing.

Share:
7,288

Related videos on Youtube

user2987902
Author by

user2987902

Updated on September 17, 2022

Comments

  • user2987902
    user2987902 over 1 year

    I went through this tutorial http://www.vanemery.com/Linux/Apache/apache-SSL.html setting up my SSL on Apache2. But when I attempt to start my server I get this error:

    Syntax error on line 1 of /etc/apache2/conf.d/ssl.crt/foo-server.crt: Invalid command '-----BEGIN', perhaps misspelled or defined by a module not included in the server configuration

    What does it seem like I'm missing in my Apache setup? How can I check?

    Aay help is greatly appreciated!

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    below is my vhost file:

    <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>