duanbing6955 2017-04-24 22:06
浏览 119

使用NGINX,Laravel Forge通过AJAX上传PHP vimeo上的502 Bad Gateway

I'm using Laravel (5.4) Forge for a web app that uploads Vimeo and Youtube videos from S3. In the past, before moving to Forge, this script worked correctly, and also still works correctly with smaller files today.

Now that I'm trying to upload larger files (~1gb), Im receiving a 502 Bad Gateway after just over 1 minute for the php upload script. The rest of the application runs fine.

Specifically, here is the error:

2017/04/24 20:36:48 [error] 2111#2111: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: X.X.X.X.X, server: myserver.com, request: "POST /recordings/vimeo/upload HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "myserver.com", referrer: "http://myserver.com/recordings"

I have tried:

  • adding / editing fastcgi directives in the nginx config
  • upping output_buffering in php
  • adding the proxy_ and client_max_body items below

Here's my NGINX config:

include forge-conf/myserver.com/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name .myserver.com;
    root /home/forge/myserver.com/public;

    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'hidden for SO';
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    include forge-conf/myserver.com/server/*;

    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/myserver.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_read_timeout 3600;
        fastcgi_buffers 8 512k;
        fastcgi_buffer_size 512k;

        include fastcgi_params;

        client_max_body_size 128M;
        proxy_buffer_size 256k; 
        proxy_buffers 4 512k;
        proxy_busy_buffers_size 512k;


    location ~ /\.ht {
        deny all;

include forge-conf/myserver.com/after/*;

What am I missing? I can't seem to figure this out at all. Thank you in advance for the help.

  • 写回答

1条回答 默认 最新

  • dqjo4340 2017-04-26 20:27

    "request_terminate_timeout" turned out to be the issue:


    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 帮我解决一下膳食平衡的线性规划模型的数据实例
  • ¥40 万年历缺少农历,需要和阳历同时显示
  • ¥250 雷电模拟器内存穿透、寻基址和特征码的教学
  • ¥200 比特币ord程序wallet_constructor.rs文件支持一次性铸造1000个代币,并将它们分配到40个UTXO上(每个UTXO上分配25个代币),并设置找零地址
  • ¥15 关于Java的学习问题
  • ¥15 如何使用chatgpt完成文本分类任务?
  • ¥15 已知速度v关于位置s的等式,怎么转化为已知位置求速度v的等式
  • ¥15 我有个餐饮系统,用wampserver把环境配置好了,但是后端的网页却进去,是为什么,能不能帮远程一下?
  • ¥15 R运行没有名称为"species"的插槽对于此对象类"SDMmodelCV"
  • ¥20 基于决策树的数字信号处理,2ask 2psk 2fsk的代码,检查下报错的原因