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 http2 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 Letsencrypt certificates

To order Letsencrypt 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

## 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 Letsencrypt!

Changing your base urls

If your ssl certificates are linked to your hypernode, or you ordered letsencrypt 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

## Execute to change the base urls to https

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