Configuring your shop to only use HTTPS

in Getting started

On Hypernode we recommend serving your site only over HTTPS traffic. This is safer and is better for search index optimization.

Most of the available browsers only support HTTP/2 when your pages are served over SSL so to use this faster and newer HTTP technology, order an SSL certificate and make sure your site is only served over HTTPS.

You can find more in-depth information in this article about SSL on Hypernode

Use regular certificates

If you use regular certificates, link them to your Hypernode through our service panel first.
This will configure the certificates and the configuration for it on your Hypernode.

Order Let’s Encrypt certificates

To order Let’s Encrypt certificates for all storefronts, use the following command:

## Create an entry for each storefront
for DOMAIN in $( n98-magerun sys:store:config:base-url:list --format=csv | sed 1d  | cut -d , -f 3 | perl -pe "s/https?://(www.)?//" | tr -d "/" | sort -u ) ; do
    echo -e "$DOMAIN www.${DOMAIN}" >> ~/.dehydrated/domains.txt
done

## Order the certificates
dehydrated -c --create-dirs

Don’t forget to add the cron to renew your certificates to the crontab if you are using Let’s Encrypt!

Changing your base URLs

If your SSL certificates are linked to your Hypernode, or you ordered Let’s Encrypt certificates, we can change the base URLs to use only HTTPS. To do this, we created a little Python script that changes all your base URLs to HTTPS.

To use this:

## Download the script
wget -O change_baseurls.py https://gist.githubusercontent.com/hn-support/0c76ebb5615a5be789997db2ae40bcdd/raw/

## Execute to change the base URLs to HTTPS
python change_baseurls.py

Routing all traffic over SSL by Nginx

If you configure your Magento shop to only use HTTPS, all HTTP traffic will be redirected to HTTPS.
If this is done by Magento, the database and PHP is used for making this redirect, which is expensive in resources.
Therefore we must configure this in Nginx, so the redirect does not use unnecessary resources.

Run the following command to add the configuration to Nginx that routes all traffic over HTTPS:

echo 'if ($scheme = http) { return 301 https://$host$request_uri; }' >> /data/web/nginx/public.ssl_redirect

Check settings of third party solutions

After configuring your shop to only use HTTPS, please do not forget to check HTTP(S) settings of third party solutions to avoid problems, e.g.:

  • Payment providers like Adyen
  • Stock providers like Picqer
  • Google Analytics and Google Search Console

0