Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi There is this weird problem going on with putting ssl on the server I keep on getting this error in the terminal after I already created the .key and .crt files but it keeps on saying I placed the files in the conf.d directory and I already configured the thing so there is something that I did wrong there I also used openssl to create a .key and the .crt files thanks for the help if anyone can

service apache2 reload
Syntax error on line 1 of /etc/apache2/conf.d/www.domainname.crt
Invalid command '-----BEGIN', perhaps misspelled or defined by a module not included in the server configuration
Action 'conftest' failed.
The Apache error log may have more information.!
share|improve this question
This suggests the certificate is either invalid, or the server is missing certain modules. Try reading the Apache error log. – Thomas W. Jun 7 '12 at 17:49

Apache will treat files in conf.d/ as config files, and the .crt file is not a valid apache config file.

Instead put them somewhere else and have the config file in sites-enabled/ refer to them. The default-ssl config has the following in it:

SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

So put your certificate file in /etc/ssl/certs/ and your key in /etc/ssl/private/ and edit the config to have the correct file names.

You might also want to read the official Ubuntu server guide about Apache and HTTPS or just search google for more information.

share|improve this answer
:O That is how you do it – Kid XD Jul 2 '12 at 4:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.