Tuesday, November 7, 2017

[Tutorial] NGINX How to force SSL with WWW or without WWW, the clean way !


To force HTTPS without WWW you can use the following block in your server block :

        if ($host ~* www\.(.*)){
                set $host_without_www $1;
                return 301 https://$host_without_www$request_uri;
        }
        if ($scheme = http)
        {
                return 301 https://$server_name$request_uri;
        }


and to force HTTPS with WWW you can use the following block :

        if ($host !~* ^www\.){
                return 301 https://www.$host$request_uri;
        }
        if ($scheme = http)
        {
                return 301 https://www.$server_name$request_uri;
        }

One can save the above blocks in separate files (force_ssl.conf and force_ssl_www.conf) and simply include the conf files in their vhost servers whenever needed.

~ Mos

How to export Apple Health / Google Fit training activity to TCX format

  I own a Xiaomi Smart Band 7, and recently, my Mi Fitness app stopped syncing running activities to Strava. Mi Fitness supports syncing dat...