502坏网关nginx闪亮文件上传

502坏网关nginx闪亮文件上传

本文介绍了502坏网关nginx闪亮文件上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 fileUpload 上传了一个大文件 (5Gb).我在闪亮的服务器代码中将文件上传限制增加到 10Gb.文件上传成功但上传完成后返回错误:

I have uploaded a big file (5Gb) using fileUpload. I have increased the file upload limit to 10Gb in the shiny server code. The file upload succeeds but returns the error after the upload is completed:

  Error : html head title 502 bad gateway /title /head

以下是我的配置信息:

options(shiny.maxRequestSize = 10000 * 1024 ^ 2)

nginx config /etc/nginx/nginx.conf 在 http 块中的基本设置如下:

The nginx config /etc/nginx/nginx.conf has the basic settings in http block as below:

http {

    map $http_upgrade $connection_upgrade {
        default upgrade;
       '' close;
    client_max_body_size 100G;
    large_client_header_buffers 8 64k;
   }
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;
 }

/etc/nginx/sites-available/default配置如下图:

server {
    listen 80 default_server;
    listen [::]:80 default_server

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;
    location /shiny/ {
    proxy_pass http://X.X.X.X:3838/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    rewrite ^(/shiny/[^/]+)$ $1/ permanent;

   }

   location /rstudio/ {
   proxy_pass http://X.X.X:8787/;
   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "upgrade";
   rewrite ^(/rstudio/[^/]+)$ $1/ permanent;
   client_max_body_size 100000M;
  }

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
   proxy_buffer_size 16k;
   proxy_buffers 8 32k;
   proxy_busy_buffers_size 224K;

   keepalive 64
}

任何尝试的提示都会有所帮助.

Any hints to try will be helpful.

推荐答案

Adding the following lines to the location/ to the config file in sites-available/myApp.com fixed the issue:

location / {

   proxy_http_version 1.1; // you need to set this in order to use params below.
   proxy_pass http://XXXXXX.XX.XX:3838;
   proxy_redirect http://XXXXXX.XX.XX:3838/ https://$host/;

   proxy_set_header   Host $http_host;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection $connection_upgrade;
   proxy_temp_file_write_size 64k;
   proxy_connect_timeout 10080s;
   proxy_send_timeout 10080;
   proxy_read_timeout 10080;
   proxy_buffer_size 64k;
   proxy_buffers 16 32k;
   proxy_busy_buffers_size 64k;
   proxy_redirect off;
   proxy_request_buffering off;
   proxy_buffering off;
}

这篇关于502坏网关nginx闪亮文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:24