我使用 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 http://loc.medifaktor/api/v1/mfusers
这是一个宅基地安装,在我的计算机上本地运行。
此错误中提到的客户端地址是 192.168.10.1,这实际上是不正确的,因为我使用的是 192.168.10.10。这可能是错误吗?我该如何更改?
[![在此处输入图像描述][1]][1]
我正在使用全新安装的 Laravel,并且尝试了其他请求,例如 GET,效果很好。仅 POST 请求会引发此错误。
php-fpm.log 显示:
[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;
}
改变你的fastcgi_pass
to 127.0.0.1:9000
在你网站的 nginx 中sites_enabled
conf 文件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)