# PrestaShop + Nginx

**URL:** https://forum.ficusonline.com/t/topic/377
**Category:** WEB Design
**Created:** [2020 年 7 月 1 日午前 2:55 UTC](https://forum.ficusonline.com/t/topic/377 "2020-07-01T02:55:12Z")
**Posts on this page:** 3
**Page:** 1

<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: [2020 年 7 月 1 日午前 2:55 UTC](https://forum.ficusonline.com/t/topic/377/1 "2020-07-01T02:55:12Z")

</div>

**PrestaShop Nginx Congiguration**

> **[Configure Nginx](https://devdocs.prestashop-project.org/1.7/basics/installation/nginx/)**
>
> Learn how to extend, modify and test PrestaShop, create modules, themes, and more.

> **[Optimize your nginx configuration](https://devdocs.prestashop-project.org/1.7/scale/webservers/nginx/)**
>
> Learn how to extend, modify and test PrestaShop, create modules, themes, and more.

**Adminディレクトリ(sub directory:store)** はフォルダ名を変更して、Nginxの設定にも反映させること。

```auto
# [REQUIRED EDIT] Change this block to your admin folder
    location /store/your-admin/ {
        if (!-e $request_filename) {
            rewrite ^/store/.*$ /store/your-admin/index.php last;
        }
    }

```

**php-fpmセクション** (sub directory:store) は以下の様に変更（Dockerコンテナphp-fpm指定）。

```auto
location ~ \.php$ {
		# Verify that the file exists, redirect to index if not
		#try_files $fastcgi_script_name /index.php$uri&$args =404;
		
		alias /$1;
		
		include fastcgi_params;
		fastcgi_index index.php;

		fastcgi_split_path_info ^\/store\/(.+\.php)(.*)$;
		# fastcgi_param HTTPS 'on';

		fastcgi_param PATH_INFO $fastcgi_path_info;
		fastcgi_param PATH_TRANSLATED $fastcgi_path_info;
		fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;

		fastcgi_pass prestashop-fpm:9000;

		fastcgi_keep_conn on;
		fastcgi_connect_timeout 10s;
		fastcgi_read_timeout 30s;
		fastcgi_send_timeout 30s;

		# In case of long loading or 502 / 504 errors
		fastcgi_buffer_size 256k;
		fastcgi_buffers 256 16k;
		fastcgi_busy_buffers_size 256k;
		client_max_body_size 10m;
	}

```

**PrestaShop(1.7.6.5)をNginxのSSL対応後にインストール**したため、以下リダイレクトエラー発生

```auto
err_too_many_redirects

```

**Prestashop** データベースに直接アクセスし、 **configration** テーブルの **PS\_SSL\_ENABLED** と **PS\_SSL\_ENABLED\_EVERYWHERE** の値を **“1”** に書換えます。

---

<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: [2022 年 7 月 31 日午前 1:10 UTC](https://forum.ficusonline.com/t/topic/377/2 "2022-07-31T01:10:06Z")

</div>

### 504 gateway time-out

デザイン —\> Email Theme —\> Generate emails

メールのテンプレート変換に時間を要するため発生。

> [@PrestaShop + Docker](https://forum.ficusonline.com/t/topic/380/11):
>
> E-Mailテンプレートの編集 ModernよりもClassicテーマの方がレイアウトが整然としていて見やすいです。 [https://devdocs.prestashop.com/1.7/development/components/mail-templates/#introduction](https://devdocs.prestashop.com/1.7/development/components/mail-templates/#introduction) メールで使用される各テンプレートは、テーマ毎 (Modern, Classic) に mails/the…

以下設定時間を見直し。`30s ---> 60s`

```auto
fastcgi_read_timeout 60s;
fastcgi_send_timeout 60s;

```

---

<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: [2022 年 12 月 26 日午前 6:27 UTC](https://forum.ficusonline.com/t/topic/377/4 "2022-12-26T06:27:28Z")

</div>

## Nginx設定アップデート

> **[Configure Nginx](https://devdocs.prestashop-project.org/1.7/basics/installation/nginx/)**
>
> Learn how to extend, modify and test PrestaShop, create modules, themes, and more.

**PrestasShopロケーションのセクション更新**

`/etc/nginx/conf.d/default.conf`

```auto
location ~ [^/store/]\.php(/|$) {
		# Split $uri to $fastcgi_script_name and $fastcgi_path_info.
		fastcgi_split_path_info ^\/store\/(.+?\.php)(.*)$;

		# Ensure that the requested PHP script exists before passing it
		# to the PHP-FPM.
		try_files $fastcgi_script_name =404;

		# Environment variables for PHP.
		include fastcgi_params;
		fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;

		fastcgi_index index.php;

		fastcgi_keep_conn on;
		fastcgi_read_timeout 30s;
		fastcgi_send_timeout 30s;

		# Uncomment these in case of long loading or 502/504 errors.
		fastcgi_buffer_size 256k;
		fastcgi_buffers 256 16k;
		fastcgi_busy_buffers_size 256k;
                client_max_body_size 10m;

		# [EDIT] Connection to PHP-FPM unix domain socket.
		fastcgi_pass prestashop-fpm:9000;
	}

```
