Nginx + Php-fpm fastcgi upstream timed out - php

I am having issues with a long-running PHP script:
<?php
sleep(70); # extend 60s
phpinfo();
Which gets terminated every time after 60 seconds with a response 504 Gateway Time-out from Nginx.
When I inspect the Nginx errors I can see that the request times out:
... [error] 1312#1312: *2023 upstream timed out (110: Connection timed out) while reading response header from upstream, ... , upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock", ...
I went through the related questions and tried increasing the timeouts creating a /etc/nginx/conf.d/timeout.conf file with the following content:
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_connect_timeout 600;
I also read through the Nginx documentation for both fastcgi and core modules, searching for any configurations with defaults set to 60 seconds.
I ruled out the client_* timeouts because they return HTTP 408 instead of HTTP 504 responses.
This is my Nginx server config portion of FastCGI:
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
}
From what I read so far this doesn't seem to be an issue with PHP rather Nginx is to blame for the timeout. Nonetheless, I tried modifying the limits in PHP as well:
My values from the phpinfo():
default_socket_timeout=600
max_execution_time=300
max_input_time=-1
memory_limit=512M
The php-fpm pool config also has the following enabled:
catch_workers_output = yes
request_terminate_timeout = 600
There is nothing in the php-fpm logs.
I am also using Amazon's Load Balancer to route to the server, but the timeout configuration is also increased from the default 60 seconds.
I don't know where else to look, during all the changes I restarted both php-fpm and nginx.
Thank you

As it happens in these cases, I was actually editing a wrong configuration file that didn't get loaded by Nginx.
Adding the following to the right file did the trick:
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_connect_timeout 600;

Related

503 Service Temporarily Unavailable after running an import-script

I have a domain on a Plesk server (version 17.8) with CentOS 7. Prestashop is installed on this domain and the products are imported via a self-programmed module.
When I start import then I get the message:
Service Temporarily Unavailable
The server is unable to service your request due to downtime or capacity problems. Please try again later.
Web Server at sportsams.ch
In the log I get this message: (70007) The timeout has been specified: AH01075: Error dispatching request to:
PHP setting for the domain:
PHP version: 7.2.18 with FPM
Memory_limit: 256M
max_execution_time: 1000
max_input_time: 1000
post_max_size: 16M
upload_max_filesize:16M
The support of Plesk told me that this must make adjustments:
Plesk> domains> sportsams.ch> Apache & nginx Settings.
Additional directives for HTTP and Additional directives for HTTPS:
FcgidIdleTimeout 1200
FcgidProcessLifeTime 1200
FcgidConnectTimeout 1200
FcgidIOTimeout 1200
Timeout 1200
ProxyTimeout 120
Click OK button to apply the changes
Unfortunately, these settings have not been successful.
I hope someone else can give me an idea.
If you need more information, let me know.
Centos 7 Server with Plesk 17.8.
PHP-Version 7.2.18 With FPM
Not sure if this applies to your Plesk configuration, but I've been using the following configuration to set the timeout correctly with PrestaShop & Nginx:
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.*)$;
fastcgi_keep_conn on;
include /etc/nginx/fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 3600;
fastcgi_param PHP_VALUE open_basedir="/var/www/myshop.com/:/tmp/";
}
If fastcgi_read_timeout does not work for you, it might be related to a hosting provider limitation detecting you are consuming too much resources.
I hope this helps!

Opencart : 504 Gateway Time-out

I have Opencart Store and have an error on the front page. I can access the backend as well.
You will get below error after loading the page:
504 Gateway Time-out
The server didn't respond in time.
I'm giving my php.ini configuration help me to solve out.
Please suggest me php.ini changes by editing .htaccess
504 Gateway Timeout error on Nginx + FastCGI (php-fpm)
For Nginx + FastCGI (php-fpm), you should try to tweak nginx configuration in this way:
Try raising max_execution_time setting in php.ini file (CentOS path is /etc/php.ini):
max_execution_time = 300
But, you should also change set request_terminate_timeout parameter (commented by default) at www.conf file from PHP-FPM:
pico -w /etc/php-fpm.d/www.conf
Then set the variable to the same value as max_execution_time:
request_terminate_timeout = 300
Now let’s add fastcgi_read_timeout variable inside our Nginx virtual host configuration:
location ~ .php$ {
root /var/www/sites/nginxtips.com;
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
}
Then restart nginx:
service nginx reload
504 Gateway Timeout error using Nginx as Proxy
For Nginx as Proxy for Apache web server, this is what you have to try to fix the 504 Gateway Timeout error:
Add these variables to nginx.conf file:
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
Then restart nginx:
service nginx reload

Error upstream timed out. What is wrong with my setup?

I am running wordpress 3.9.1 on a 2GB ram / 2x CPU digitalocean vps with nginx and php5-fpm on tcp/ip 127.0.0.1:9000 under debian 7 x64. I am experiencing massive 504 gateway timeouts.
nginx log output is:
upstream timed out (110: Connection timed out) while connecting to upstream or
upstream timed out (110: Connection timed out) while reading response header from upstream
www.conf:
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 25
pm.start_servers = 4
pm.min_spare_servers = 4
pm.max_spare_servers = 8
pm.max_requests = 200
listen_backlog = 65536
request_terminate_timeout = 30
php.ini:
max_execution_time = 30
nginx.conf:
worker_processes 2;
worker_connections 1024;
client_max_body_size 10M;
fastcgi_read_timeout 30s;
client_header_timeout 30s;
client_body_timeout 30s;
fastcgi_send_timeout 30s;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
keepalive_timeout 65;
gzip on;
The recommended settings of DO for the sysctl.conf are:
# Digital Ocean Recommended Settings:
net.core.wmem_max=12582912
net.core.rmem_max=12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912
the following was removed completely:
php5-fpm.conf (/etc/nginx/conf.d/):
upstream php5-fpm-sock {
server unix:/var/run/php5-fpm.sock;
}
I also tried to disable my plugins with no luck. The site becomes unresponsive while the wordpress dashboard shows "connection lost" message and eventually 504 gateway timeout.
Anyone with a similar experience?
Any suggestions would be appreciated.
Thanks.
Nginx worker_processes should correlate directly to the CPU threads; since you have a 2 core CPU then you should have 2 worker_processes threads.
Next, try increasing the php-fpm servers to x4 of CPU threads. Something like:
pm.start_servers = 4
pm.min_spare_servers = 4
pm.max_spare_servers = 8
Also, nginx is complaining of the upstream timeouts. Do you have any upstream confs/servers ?

Script times out after 240 seconds

I'm running an Nginx + PHP-FPM server and I have a script that is supposed to execute over 30 minutes. After 240 seconds it ceases to function and returns a 502 Gateway error from Nginx.
PHP-FPM Log for the execution:
[03-May-2013 19:52:02] WARNING: [pool www] child 2949, script
'/var/www/shell/import_db.php' (request: "GET /shell/import_db.php")
execution timed out (239.971196 sec), terminating
[03-May-2013 19:52:02] WARNING: [pool www] child 2949 exited on signal 15 (SIGTERM) after 540.054237 seconds from start
[03-May-2013 19:52:02] NOTICE:
[pool www] child 3049 started
Nginx log for the execution:
2013/05/03 19:52:02 [error] 2970#0: *1 recv() failed (104: Connection
reset by peer) while reading response header from upstream, client:
98.172.80.203, server: www.example.net, request: "GET /shell/import_db.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000",
host: "www.example.net"
I've run this script on an apache+suphp server and it executes flawlessly. Nonethless, I am including:
set_time_limit(0); at the top of my script.
The max_execution_time according to phpinfo() is 1800 seconds (this was originally 300, I bumped it up to this in an attempt to get it working).
FastCGI Nginx Configuration:
## Fcgi Settings
include fastcgi_params;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 600s;
fastcgi_buffer_size 4k;
fastcgi_buffers 512 4k;
fastcgi_busy_buffers_size 8k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors off;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
# nginx will buffer objects to disk that are too large for the buffers above
fastcgi_temp_path /tmpfs/nginx/tmp 1 2;
#fastcgi_keep_conn on; # NGINX 1.1.14
expires off; ## Do not cache dynamic content
I've restarted php-fpm and nginx to no avail. What setting or configuration am I missing from this or that I could check?
When you run nginx with php-fpm, nginx tries to so stay connected with php-fpm's children. You should set the following directive to change that:
fastcgi_keep_conn off;

PHP-FPM and Nginx: 502 Bad Gateway

Configuration
Ubuntu Server 11.10 64 bit
Amazon AWS, Ec2, hosted on the cloud
t1.micro instance
Before I write anything else, I'd like to state that I've checked both nginx 502 bad gateway and Nginx + PHP-FPM 502 Bad Gateway threads, which unfortunately haven't helped me in this regard.
The issue appears to be rather common: a misconfiguration of nginx or php-fpm can lead to a 502 Bad Gateway error, which is something that I haven't been able to get rid of. Note that this appears even when I go to my domain root, without specifying any particular directory.
I'm running an Amazon EC2 webserver, with port 9000 enabled, port 80 open, etc.
The question in particular is, how can I get rid of this nasty error? Or, better yet, how can I get php5-fpm to actually work.
What I Have Attempted so Far
Mostly consistent editing of configuration files, notably php-fpm.conf and nginx.conf.
i. php-fpm.conf
I've added the following, which hasn't quite helped much:
;;;;;;;;;;;;;
; Fpm Start ;
;;;;;;;;;;;;;
;pm.start_servers = 20
;pm.min_spare_servers = 5
;pm.max_spare_servers = 35
Now, afterward I tried including my configuration files:
include=/etc/php5/fpm/*.conf
Which only screwed me even further.
Full Configuration
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr). This prefix can be dynamicaly changed by using the
; '-p' argument from the command line.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p arguement)
; - /usr otherwise
;include=/etc/php5/fpm/*.conf
;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;
[global]
; Pid file
; Note: the default prefix is /var
; Default Value: none
pid = /var/run/php5-fpm.pid
; Error log file
; Note: the default prefix is /var
; Default Value: log/php-fpm.log
error_log = /var/log/php5-fpm.log
; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
log_level = notice
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0
; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
emergency_restart_interval = 0
; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
daemonize = no
;;;;;;;;;;;;;
; Fpm Start ;
;;;;;;;;;;;;;
;pm.start_servers = 20
;pm.min_spare_servers = 5
;pm.max_spare_servers = 35
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
; Multiple pools of child processes may be started with different listening
; ports and different management options. The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :)
; To configure the pools it is recommended to have one .conf file per
; pool in the following directory:
include=/etc/php5/fpm/pool.d/*.conf
ii. nginx.conf
In all honesty this configuration is a smattering of a few websites I've visited, but I can tell you that before this 502 Bad Gateway business, the server was running fine (without PHP working. Period.).
The issue primarily lies in the fact that something is terribly, terribly wrong. And now, when I try to do a service php5-fpm restart, it hangs in what I'm guessing is an infinite loop or something, which I can't even CTRL-C out of.
Full Configuration
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 64;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush off;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen 80;
server_name ec2-xx-xx-xx-xx.compute-x.amazonaws.com;
location ~ ^(.+\.php)(.*)$ {
root /home/wayvac/public;
fastcgi_pass unix:/var/run/php5-fpm.pid;
#fastcgi_pass 127.0.0.1:9000; #Un-comment this and comment "fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;" if you are not using php-fpm.
fastcgi_index index.php;
set $document_root2 $document_root;
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root2$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root2$fastcgi_path_info;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT $document_root2;
}
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
root /home/wayvac/public;
index index.html index.htm index.php;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
#include drop.conf;
#include php.conf;
}
}
If anyone finds this page by encountering the same problem I had, I found the answer here.
For those of you who can't be bothered to click and work it out for themselves... ;)
The Condition:
Ubuntu or Debian server with NGINX and PHP 5.3 works fine but upgrading PHP to 5.4 gives 502 Bad Gateway errors. Looking for services running on port 9000 (typically running netstat -lp or similar) returns nothing.
The fix:
Open /etc/php5/fpm/pool.d/www.conf and make a note of the 'listen' parameter (in my case /var/run/php5-fpm.sock):
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock
and replace the fastcgi_pass variable in your vhost with the location you just noted.
So this sample symfony2 configuration (taken from here):
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ ^/(app|app_dev)\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
becomes this:
# pass the PHP scripts to FastCGI server at /var/run/php5-fpm.sock
location ~ ^/(app|app_dev)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
Then restart nginx:
sudo /etc/init.d/nginx restart
Note: replace ~ ^/(app|app_dev)\.php(/|$) { with ~ ^/index\.php(/|$) { if you're not on SF2**
Hope this saves someone a little bit of time :)
Edit
Of course, you could change the listen = /var/run/php5-fpm.sock to listen = 127.0.0.1:9000 in /etc/php5/fpm/pool.d/www.conf then restart php5-fpm (which would save you from having to change your vhosts), but you have to assume they changed php5-fpm to run through a socket rather than listening on port 9000 for a reason.
Edit2
If you're still experiencing 502 error see this answer.
Try setting these values, it solves problem in fast-cgi
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
I made all this similar tweaks, but from time to time I was getting 501/502 errors (daily).
This are my settings on /etc/php5/fpm/pool.d/www.conf to avoid 501 and 502 nginx errors…
The server has 16Gb RAM. This configuration is for a 8Gb RAM server so…
sudo nano /etc/php5/fpm/pool.d/www.conf
then set the following values for
pm.max_children = 70
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 35
pm.max_requests = 500
After this changes restart php-fpm
sudo service php-fpm restart
If you met the problem after upgrading php-fpm like me, try this:
open /etc/php5/fpm/pool.d/www.conf
uncomment the following lines:
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
then restart php-fpm.
Don't forget that php-fpm is a service. After installing it, make sure you start it:
# service php-fpm start
# chkconfig php-fpm on
For anyone else struggling to get to the bottom of this, I tried adjusting timeouts as suggested as I didn't want to stop using Unix sockets...after lots of troubleshooting and not much to go on I found that this issue was being caused by the APC extension that I'd enabled in php-fpm a few months back. Disabling this extension resolved the intermittent 502 errors, easiest way to do this was by commenting out the following line :
;extension = apc.so
This did the trick for me!
You should see the error log.
By default, its location is in /var/log/nginx/error.log
In my case, 502 get way because of:
GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
2016/05/25 11:57:28 [error] 22889#22889: *3 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: symfony2.local, request: "GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
2016/05/25 11:57:29 [error] 22889#22889: *3 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: symfony2.local, request: "GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
2016/05/25 11:57:29 [error] 22889#22889: *3 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: symfony2.local, request: "GET /app_dev.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "symfony2.local"
When we know exactly what is wrong, then fix it. For these error, just modify the buffer:
fastcgi_buffers 16 512k;
fastcgi_buffer_size 512k;
The port was changed to 9001 in 5.4, just changing the port from 9000 to 9001 in the nginx conf and in php-fpm configuration worked for me.
Hope this tip will save someone else's life. In my case the problem was that I ran out of memory, but only slightly, was hard to think about it. Wasted 3hrs on that. I recommend running:
sudo htop
or
sudo free -m
...along with running problematic requests on the server to see if your memory doesn't run out. And if it does like in my case, you need to create swap file (unless you already have one).
I have followed this tutorial to create swap file on Ubuntu Server 14.04 and it worked just fine:
http://www.cyberciti.biz/faq/ubuntu-linux-create-add-swap-file/
I've also found this error can be caused when writing json_encoded() data to MySQL. To get around it I base64_encode() the JSON. Please not that when decoded, the JSON encoding can change values. Nb. 24 can become 24.00
All right after trying every solution on the web I ended up figuare out the issue using very simple method , first I cheked php-fpm err log
cat /var/log/php5-fpm.log
and the most repeated error was
" WARNING: [pool www] server reached pm.max_children setting (5), consider raising it "
I edit PHP-fpm pools setting
nano /etc/php5/fpm/pool.d/www.conf
I chenged This Line
pm.max_children = 5
To new Value
pm.max_children = 10
BTW I'm using low end VPS with 128MB ram As everyone else I was thinkin redusing pm.max_children will make my server run faster consume less memory , but the setting we using were too low tho even start PHP-fpm process .
I hope this help others since I found this after 24 hour testing and failing , ever my webhost support were not able to solve the issue .
I'm very late to this game, but my problem started when I upgraded php on my server. I was able to just remove the .socket file and restart my services. Then, everything worked. Not sure why it made a difference, since the file is size 0 and the ownership and permissions are the same, but it worked.
Before messing with Nginx config, try to disable ChromePHP first.
1 - Open app/config/config_dev.yml
2 - Comment these lines:
chromephp:
type: chromephp
level: info
ChromePHP pack the debug info json-encoded in the X-ChromePhp-Data header, which is too big for the default config of nginx with fastcgi.
In your NGINX vhost file, in location block which processes your PHP files (usually location ~ \.php$ {) through FastCGI, make sure you have next lines:
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
After that don't forget to restart fpm and nginx.
Additional:
NGINX vhost paths
/etc/nginx/sites-enabled/ - Linux
'/usr/local/etc/nginx/sites-enabled/' - Mac
Restart NGINX:
sudo service nginx restart - Linux
brew service restart nginx - Mac
Restart FPM:
Determine fpm process name:
- systemctl list-unit-files | grep fpm - Linux
- brew services list | grep php - Mac
and then restart it with:
sudo service <service-name> restart - Linux
brew services restart <service-name> - Mac
Maybe this answer will help:
nginx error connect to php5-fpm.sock failed (13: Permission denied)
The solution was to replace www-data with nginx in /var/www/php/fpm/pool.d/www.conf
And respectively modify the socket credentials:
$ sudo chmod nginx:nginx /var/run/php/php7.2-fpm.sock

Categories