7
7

More than 5 years have passed since last update.

ec-cube3系向けnginxの設定

Last updated at Posted at 2016-07-18

ec-cube3系のwebサーバとしてnginxを利用する場合のnginxのサーバ設定で
参考になりそうな記事が見つからなくて苦労したので備忘の為にメモしておきます。
(以下設定はCentOS7、事前にphp-fpmはインストールしてある前提のものです)

環境

  • CentOS7
  • nginx 1.6.3
  • php-fpm 7.0.8
  • php 7.0.8

confファイルの内容

vi /etc/nginx/conf.d/eccube.conf
server {
    server_name eccube.xxx.com; # 任意の値に変更
    root        /path_to_eccube/html; #ec-cubeの配置ディレクトリを指定
    index       index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?u=$uri&$args;
    }

    location ~ \.php {
        fastcgi_pass  127.0.0.1:9000; # php-fpmのlistenポートを指定
        fastcgi_index /index.php;

        include fastcgi_params;
        fastcgi_split_path_info       ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    }

    location ~ /\.ht {
        deny all;
    }

    error_log /var/log/nginx/eccube_error.log; # エラーログファイル名を変更する場合に指定
    access_log /var/log/nginx/eccube_access.log; # アクセスログファイルを変更する場合に指定
}

7
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7