Dockerコンテナ(NGINX+MariaDB+PHP-FPM+phpMyAdmin)によるサイト構築

Mixed Content Error

NGINX+FastCGI(共にDockerコンテナ)によるサイトの表示エラー。
HTTPSページ読み込み時のエラーで、ページを構築するために必要なCSS,JS等の関連ファイルをHTTPで読み込もうとするために生じるエラー。

Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure stylesheet '<URL>'. This request has been blocked; the content must be served over HTTPS.

対策

NginxからFastCGIコンテナへのパスをHTTPSで指定。Nginxの設定は以下の通り。

fastcgi_param HTTPS 'on';を追加

location = /index.php {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_keep_conn on;
        fastcgi_param  HTTPS 'on';
        fastcgi_pass   php-fpm:9000;
        fastcgi_index  index.php;
        include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

参考