Nginx+PHP-FPM構成でmax_execution_timeを変更するなら、
NginxとPHP-FPMも対応させないと意味がない
もくじ
max_execution_time = 300に変更する例
# vi php.ini max_execution_time = 300
$ sudo vi /etc/nginx/sites-available/default ・・・ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { include snippets/fastcgi-php.conf; # # # With php7.0-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # With php7.0-fpm: fastcgi_pass unix:/run/php/php7.2-fpm.sock; fastcgi_param HOSTNAME $client; fastcgi_connect_timeout 300; ←●追加 fastcgi_read_timeout 300; ←●追加 proxy_set_header X-Real-IP $remote_addr; } ・・・
$ sudo vi /etc/php/7.2/fpm/pool.d/www.conf ・・・ ; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 ;request_terminate_timeout = 0 request_terminate_timeout = 300 ←●追加 ・・・
反映
$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful $ sudo service nginx reload $ sudo service php7.2-fpm reload
これで糸冬🐱✨
番外 AWS ALB配下での標準設定
# 私が前職で標準的にやっていた設定 fastcgi_connect_timeout 120; fastcgi_read_timeout 120; fastcgi_send_timeout 120; keepalive_timeout 120; keepalive_requests 100; client_header_timeout 60s; client_body_timeout 60s; send_timeout 300;