install crt into apache

Robogrinch used Ask the Experts™
Hi, I am using Apache on debian 8, how do I install a crt file into it? I dont use virtual hosts I dont think... I only host 1 site.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Computer Technician
Top Expert 2015
1) First enable Apache ssl
sudo a2enmod ssl
sudo a2ensite default-ssl
sudo service apache2 restart

Open in new window

2) Create a directory for your certificates (Example: /etc/certs/) and enter the directory

3) Your certificate provider will require you to create a CSR. Instructions to do so can be found on your cert provider website or you can generate a CSR use the following command.  You will be asked to answer some questions. Once finished  It will create two files: mycert.csr and mycert.key
openssl req -new -newkey rsa:2048 -nodes -keyout mycert.key -out mycert.csr

Open in new window

4) Open the mycert.csr file and copy what's inside. Paste it on your certificate providers website. You will receive 2 certificates. Your certificate plus an intermediate certificate. Put both certs in /etc/certs/. You can name them mycert.crt and intermediate.crt

5) Your apache2 configuration file will be in /etc/apache2/sites-enabled/default-ssl.conf. Open that file. Modify the following lines.
SSLCertificateFile      /etc/certs/mycert.crt
SSLCertificateKeyFile   /etc/certs/mycert.key
SSLCertificateChainFile /etc/certs/intermediate.crt

Open in new window

5) Restart Apache and you should be good to go.

Note: When restarting apache2 it will ask you for a password. To prevent that from happening enter your /etc/certs/ directory and running the following commands
openssl rsa -in mycert.key -out mycert.key2
mv mycert.key mycert.key.orig
mv mycert.key2 mycert.key

Open in new window

Restart apache to make sure it works and is not asking for a password.


Awesome answers, thank you very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial