I had following error message while installing apache2 localhost
service apache2 reload
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
Syntax error on line 52 of /etc/apache2/sites-enabled/default-ssl:
SSLCertificateKeyFile: file '/etc/ssl/private/ssl-cert-snakeoil.key' does not exist or is empty
Action 'configtest' failed.
The Apache error log may have more information. ...fail!How to resolve this ?
3 Answers
There are two answers to your question.
The first is the short answer that directly addresses the error in your log:
file '/etc/ssl/private/ssl-cert-snakeoil.key' does not exist or is empty
Apache is stopping because the SSL certificate is missing. Simply remove the default SSL configuration from the sites-enabled folder using sudo rm /etc/apache2/sites-enabled/default-ssl and Apache should start up no problem. To re-enable the ssl site after you've adjusted the configuration you can run sudo ln -s /etc/apache2/sites-available/default-ssl etc/apache2/sites-enabled/default-ssl.
The second answer is the correct answer, which is to take a good look at the Apache documentation to determine why your configuration is incorrect. Because the values in your error log look like the defaults from a fresh Apache install I included the first answer, but after you do the above you should dedicate some time to reading the documentation. You will learn a lot and will find out why there was no snakeoil.pem file and what a snakeoil certificate means.
You can find the general documentation here:
(or depending)
You can find general configuration documentation here:
You can find the mod_ssl documentation here:
It looks like You have forgotten sudo:
sudo service apache2 reload You need to create a SSL certificate for your server and link the SSLCertificateFile (a .crt-file) and SSLCertificateKeyFile (a .key-file) to your certificate and certificate key.
This is done in the configuration file which Apache reads on startup. Usually it is located in /usr/local/apache2/conf/extra/httpd-ssl.conf. In your case it is located in /etc/ssl/private/sites-enabled/default-ssl
To create a self signed certificate follow these instructions
If you have bought a certificate you simply just locate it and copy the path.