Technical Help & Resources / Enabling HTTPS - Setting Up HTTPS Certificates

Enabling HTTPS - Setting Up HTTPS Certificates


Why use HTTPS?

HTTPS protects your websites traffic from malicous actors by encrypting thr traffic between the client and your website.
This is very important for sites that require login or would have the user submit any information.

Setting up the Certificates

With access to your host login through ssh and follow the steps below.
Be aware that this documentation is based off a newly setup host.

Change the directory and then run openssl to genorate your certificate


cd /etc/apache2/certs

sudo openssl req -new -newkey rsa:4096 -x509 -sha256 -days 1095 -nodes -out apache.crt -keyout apache.key


This will create two files within the directory apache.crt and apache.key


Edit your websites configuration file using the command below.

sudo nano /etc/apache2/sites-enabled/000-default.conf

The configuration shown below will be already within the file and can be uncommented.


Uncomment the following lines within the configuration file

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]

If you do not find the lines above, add them inside the <VirtualHost *:80> section


While still in the file go to the bottom and uncomment the lines below

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    SSLEngine on
    SSLCertificateFile /etc/apache2/certs/apache.crt
    SSLCertificateKeyFile /etc/apache2/certs/apache.key
</VirtualHost>

If you do not find the lines above, add them at the end of the file.


Once done, save the changes made to the configuration file by pressing (CTL + S) to save and then (CTL + X) to exit.

After the configuration is saved run the command below to gracefully restart the server.

sudo apachectl graceful

Now that your server is configured you will need to provide the generated certificates to our team to use for our infrastructure to aproprately redirect traffic when you have visitors. Without these certificates our servers will not be able to properly redirect incomming HTTPS traffic to your host. *This is due to the fact that the traffic will be encrypted and wont be able to be decrypted to be redirected.

Changes will be made within 24 hours of the request.