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 configure reverse proxy for Kodi web interface (chorus2)

 This tutorial goes over the steps to configure chorus2 behind nginx reverse proxy so you can remotely control your Kodi setup. First Enabl...