我将Laravel 5.3与最新的Homestead安装程序一起使用。向API发出POST请求时,根据日志文件出现此错误:
2016/10/29 12:44:34 [错误] 776#0:* 28 recv()失败(104:对等连接重置),同时从上游读取响应标头,客户端:192.168.10.1,服务器:loc.medifaktor,请求:“ POST / api / v1 / mfusers HTTP / 1.1”,上游:“ fastcgi:// unix:/var/run/php5-fpm.sock$
我使用POSTMAN发出POST请求,将其发送到URL: http://loc.medifaktor/api/v1/mfusers
这是一个家庭安装,可以在我的计算机上本地运行。
此错误中提到的客户端地址是192.168.10.1,实际上不正确,因为我使用的是192.168.10.10。这可能是错误,我该如何解决?
[![在此处输入图片描述] [1]] [1]
我正在使用全新安装的Laravel,并且尝试了其他类似GET的请求,这些请求都可以正常工作。仅POST请求会引发此错误。
php-fpm.log显示:
Run Code Online (Sandbox Code Playgroud)[29-Oct-2016 13:47:15] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
这是nginx配置的输出:
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;
}
Run Code Online (Sandbox Code Playgroud)
如果您最近运行了 sudo apt-get update 并安装了新版本的 PHP,并使用了 nginx,请确保您已更新 /etc/nginx/sites-enabled 中的 fastcgi_pass 设置,例如:
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
Run Code Online (Sandbox Code Playgroud)
您还应该确保安装最新版本的 pdo_pgsql 扩展。
| 归档时间: |
|
| 查看次数: |
11113 次 |
| 最近记录: |