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

**URL:** https://forum.ficusonline.com/t/topic/337
**Category:** Server
**Created:** [2019 年 11 月 19 日午前 5:50 UTC](https://forum.ficusonline.com/t/topic/337 "2019-11-19T05:50:27Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2019 年 11 月 28 日午前 1:57 UTC](https://forum.ficusonline.com/t/topic/337/3 "2019-11-28T01:57:57Z")

</div>

### 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';`を追加

```auto
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;
    }

```

**参考**

> **[Setting HTTPS $\_SERVER variables in PHP-FPM with Nginx](https://ma.ttias.be/setting-https-server-variables-in-php-fpm-with-nginx/)**
>
> A typical Nginx setup uses fastcgi\_pass directives to pass the request to the PHP-FPM daemon. If you would be running an Apache setup, Apache would automatically set the HTTPS server variable, that PHP code can check via $\_SERVER\['HTTPS'\] to...

> <https://stackoverflow.com/questions/4848438/fastcgi-application-behind-nginx-is-unable-to-detect-that-https-secure-connectio>

---

_[View the full topic](https://forum.ficusonline.com/t/topic/337)._
