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. This happens when the app is deployed on a host server running nginx in Ubuntu flavour. The file upload succeeds when the app is run locally.
Error : html head title 502 bad gateway /title /head
Below are my config info:
options(shiny.maxRequestSize = 10000 * 1024 ^ 2)
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;
}
The /etc/nginx/sites-available/default
configuration is as shown below:
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;
client_max_body_size 100G;
}
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 100G;
}
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 64k;
proxy_buffers 8 64k;
proxy_busy_buffers_size 500K;
keepalive 64
}
The /etc/nginx/sites-available/myApp.com
and /etc/nginx/sites-enabled/myApp.com
configuration is as shown below:
server_name XXXXXX.XX.XX; # managed by Certbot
client_max_body_size 100G;
# return 301 https://$server_name$request_uri;
location / {
proxy_pass http://XXXXXX.XX.XX:3838;
proxy_redirect http://XXXXXX.XX.XX:3838/ https://$host/;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
proxy_buffer_size 64k;
proxy_buffers 8 64k;
}
# listen 80;
#listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/XXXXXX.XX.XX/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/liveXXXXXX.XX.XX/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
listen 80 ;
server_name XXXXXX.XX.XX;
return 301 https://$host$request_uri; # managed by Certbot
}
Here is the /etc/shiny-server/shiny-server.conf
info:
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
preserve_logs true;
# Define a server that listens on port 3838
server {
listen 3838;
#client_max_body_size 100G;
# Define a location at the base URL
location / {
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server/;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server/myApp/;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index off;
}
}
Any hints to try will be helpful.