pundit
Posts: 11
Joined: Sat Jul 07, 2018 10:01 pm

Installing SSL on Raspberry Pi

Wed Aug 29, 2018 9:05 am

G'day,

I'm trying to install my SSL that I have received from RapidSSL onto my web server on my Raspberry Pi.

I have three files;
private key *.key and
publickey *.crt
intermediatekey *.crt

I have moved these three files into:

/etc/apache2/ssl-certs

However, I cannot really find documentation regarding where to install these files exactly i.e. where to move these two files so that apache will read them properly.

I have also edited the file here:
/etc/apache2/sites-available/default-ssl.conf

with

SSLCertificateFile /etc/apache2/ssl-certs/rapid***publickey.crt
SSLCertificateKeyFile /etc/apache2/ssl-certs/private.key

and under Certificate Authoority(CA):

SSLCACertificatePath /etc/apache2/ssl-certs
SSLCACertificateFile /etc/apache2/ssl-certs/rapid***intermediate.crt

When I try to run a2ensite and mywebsite.com,

I get the error:

Site mywebsite.com does not exist!

Could someone please point me in the right direction?

Thank you.
Pundit.

User avatar
rpdom
Posts: 14483
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Installing SSL on Raspberry Pi

Wed Aug 29, 2018 9:29 am

Do you have a configuration file set up for your site?

/etc/apache2/sites-available/mywebsite.com

Ideally the links to the ssl certificate files should be in there. Then a2ensite mywebsite.com should work.

pundit
Posts: 11
Joined: Sat Jul 07, 2018 10:01 pm

Re: Installing SSL on Raspberry Pi

Wed Aug 29, 2018 9:57 am

Thank you for your reply.

Could you please explain in detail what do you mean by conf file for my site?

I have included that here:

I have also edited the file here:
/etc/apache2/sites-available/default-ssl.conf

with

SSLCertificateFile /etc/apache2/ssl-certs/rapid***publickey.crt
SSLCertificateKeyFile /etc/apache2/ssl-certs/private.key

and under Certificate Authoority(CA):

SSLCACertificatePath /etc/apache2/ssl-certs
SSLCACertificateFile /etc/apache2/ssl-certs/rapid***intermediate.crt

When I try to run a2ensite and mywebsite.com,

I get the error:

Site mywebsite.com does not exist!

User avatar
rpdom
Posts: 14483
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Installing SSL on Raspberry Pi

Wed Aug 29, 2018 10:08 am

The command "a2ensite mywebsite.com" looks in /etc/apache2/sites-available for a file called mywebsite.com. If found, it links it to /etc/apache2/sites-enabled/mywebsite.com and that enables the site. If you have just put the configuration for your site in the default configuration files you don't need to do the a2ensite, just reload the Apache configuration.

There are loads of tutorials on the web on how to set up a Linux Apache2 website with SSL. It isn't Pi specific.

pundit
Posts: 11
Joined: Sat Jul 07, 2018 10:01 pm

Re: Installing SSL on Raspberry Pi

Mon Sep 03, 2018 12:30 am

Fixed it and learned a lot whilst doing it as always...

Firstly, learned the difference between sites-available and sites-enabled in apache2

So,

your website is located in:

Code: Select all

/etc/apache2/sites-enabled
Locate and edit the .conf in the above location that has your website details

ensure your certs are uploaded to:

Code: Select all

/usr/local/ssl/crt...
AND ENSURE

Code: Select all

service apache2 restart
boom, Bob's your uncle! :)

Return to “Networking and servers”