Categories
Uncategorized

Adding an SSL certificate to EC2

Buy Certificates

Buy your SSL certificate from a provider. I got mine from namecheap.
Transfer your SSL certificate bundle files onto your server, for example into /ssl/ folder.

Enable

If you are using Apache then your first step would be to enable the SSL module in Apache and then restart it.

sudo -i
a2enmod ssl
service apache2 restart

Configure

Now add the following into your Apach2 config file. Usually /etc/apache2/apache2.conf
You need to replace the example.com with your domain name that you are using.

LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
DocumentRoot "/var/www/html"
ServerName www.example.com
SSLEngine on
SSLCertificateFile "/ssl/www_example_com.crt"
SSLCertificateKeyFile "/ssl/example.key"
SSLCACertificateFile "/ssl/bundle.crt"
ServerName example.com
Redirect permanent / https://www.example.com/
ServerName example.com
Redirect permanent / https://www.example.com/
ServerName www.example.com
Redirect permanent / https://www.example.com/

Ensure that in your security groups, that port 443 is open to inbound traffic, then you should be able to access your site from
https://www.example.com/