我有nginx版本:1.12.0和以下配置:
http {
server {
listen 443;
server_name SERVER_NAME_OR_IP;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
ssl on;
ssl_certificate /path/to/cert.crt;
ssl_certificate_key /path/to/cert.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location ~* /test/abcd/ {
proxy_pass http://127.0.0.1:7000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_address;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 127.0.0.1:7000;
server_name SERVER_NAME_OR_IP;
location / {
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PHP_VALUE "upload_max_filesize = 3072M \n post_max_size=3072M";
include /etc/nginx/fastcgi_params;
}
}
}
如果客户端在上传文件期间关闭了连接,我在/var/log/error.log中看到:“epoll_wait()报告客户端过早关闭连接,因此上游连接也被关闭,同时向上游发送请求”和“客户过早关闭连接“。我的问题是当客户端关闭连接时php-fpm没有收到该错误,所以我无法在我的代码中捕获此错误。你知道可能是什么问题吗?
谢谢!