1
我正在使用Laravel(5.4)Forge上傳Vimeo和Youtube視頻的網絡應用程序。在過去,在轉移到Forge之前,這個腳本正常工作,並且在今天小文件仍然正常工作。502在PHP上的錯誤網關通過AJAX與NGINX,Laravel Forge上傳vimeo
現在,我正在嘗試上傳大文件(〜1GB),我剛剛在php上傳腳本超過1分鐘後收到502壞網關。其他應用程序運行良好。
具體地,這裏是錯誤:
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"
我曾嘗試:
- 在nginx的配置
- 在PHP
- 添加proxy_正在增加output_buffering添加/編輯的fastcgi指令和client_max_body項目低於
這裏是我的NGINX配置:
include forge-conf/myserver.com/before/*;
server {
listen 80;
listen [::]:80;
server_name .myserver.com;
root /home/forge/myserver.com/public;
# FORGE SSL (DO NOT REMOVE!)
# 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/*;
我缺少什麼?我似乎無法弄清楚這一點。預先感謝您的幫助。
我看到你提到的upwork這個主題並應用到它。無論如何,你的問題在於php配置而不是nginx配置。你必須有一個php上傳文件限制> 1024M,有足夠的內存和足夠大的超時nginx和php。 – peixotorms