11

I use Laravel 5.3 with the latest Homestead Setup. When I make a POST Request to my API, I get this error according to the log file:

2016/10/29 12:44:34 [error] 776#0: *28 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.10.1, server: loc.medifaktor, request: "POST /api/v1/mfusers HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock$

I use POSTMAN to make the POST Request sending it to the URL: http://loc.medifaktor/api/v1/mfusers

which is a homestead installation and runs locally on my computer.

The client address mentioned in this error is 192.168.10.1 which is actually not true, as I use 192.168.10.10. Could this be the mistake and how do I change that?

I am using a fresh install of Laravel and I tried other requests like GET which work fine. Just the POST Request throws this error.

The php-fpm.log shows:

[29-Oct-2016 13:47:15] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful 

This is the output of the nginx config:

server { listen 80; listen 443 ssl; server_name loc.medifaktor; root "/home/vagrant/Development/Source/MFServer/public"; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/loc.medifaktor-error.log error; sendfile off; client_max_body_size 100m; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; } location ~ /\.ht { deny all; } ssl_certificate /etc/nginx/ssl/loc.medifaktor.crt; ssl_certificate_key /etc/nginx/ssl/loc.medifaktor.key; } 
9
  • could you show your PHP-FPM error logs? Commented Oct 29, 2016 at 13:49
  • I only found the file php-fpm.log in the var/log folder (edited question) Commented Oct 29, 2016 at 13:54
  • The error log is not clear enough... But maybe you can try to set catch_workers_output = yes on your php-fpm configuration file. It will redirect worker stdout and stderr into main error log. Commented Oct 29, 2016 at 13:58
  • I added the nginx config as well if that helps? Commented Oct 29, 2016 at 13:59
  • 1
    there is nothing wrong with your nginx config I guess.. I've the same problem with you a few months ago. And these were what I did. Update the pm.max_requests to 500 and restart the fpm service, sudo service php5-fpm restart. Hope it will work for you too. Commented Oct 29, 2016 at 14:05

3 Answers 3

9

Change your fastcgi_pass to 127.0.0.1:9000 in your website's nginx sites_enabled conf file.

Sign up to request clarification or add additional context in comments.

1 Comment

It's crazy, but it was the only thing that helped in my case. It'd be great to know why this change is needed.
7

If you recently ran sudo apt-get update and installed a new version of PHP, and use nginx, make sure you've updated your fastcgi_pass setting in /etc/nginx/sites-enabled, e.g.:

fastcgi_pass unix:/run/php/php7.3-fpm.sock; 

You should also make sure you install the latest version of the pdo_pgsql extension.

Comments

0

Keep in mind, that your PHP version must match your indicated fastcgi_pass fpm. sock. For example, you have php version 7.4. then you should use the code below.

fastcgi_pass unit:/run/php7.4-fpm.sock 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.