1、修改Nginx配置。
在nginx.conf中的http层加上fastcgi参数如下:
http {
...
fastcgi_connect_timeout=300; #fastcgi连接超时时间,默认60秒
fastcgi_send_timeout=300; #nginx 进程向 fastcgi 进程发送请求过程的超时时间,默认值60秒
fastcgi_read_timeout =300 #fastcgi 进程向 nginx 进程发送输出过程的超时时间,默认值60秒
....
}
2、修改PHP配置
在php.ini 中找到max_execution_time参数并修改。
; Maximum execution time of each script, in seconds
;
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 1;#限定了脚本的最大执行时间(单位是秒)
在php-fpm.conf中找到request_terminate_timeout 参数并修改
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0
request_terminate_timeout = 4s;#设置为 ‘0’ 表示 ‘Off’。可用单位:s(秒),m(分),h(小时)或者 d(天)。默认单位:s(秒)。默认值:0(关闭)。
修改配置后注意重启ngnix或重载配置。
Powered by ddoss.cn 12.0
©2015 - 2025 ddoss
渝公网安备50011302222260号
渝ICP备2024035333号
【实验平台安全承诺书】
小绿叶技术社区,优化网络中,点击查看配置信息
主机监控系统: 安全防火墙已开启检查cc攻击-下载文件完成后等待10s 恢复访问,检查连接数低于峰值恢复访问
您的IP:216.73.216.110,2025-12-01 15:20:52,Processed in 0.01056 second(s).