Nginx

反向代理後面的owncloud下載失敗

  • November 7, 2015

我有帶有 nginx 的樹莓派作為反向代理,還有另一台在 nginx 上帶有 owncloud 的機器。

我可以連接和瀏覽頁面,但是當我嘗試下載重量超過 50 個月的文件時,下載開始有點失敗。

我知道問題來自反向代理,因為如果我直接(本地)訪問owncloud,下載工作。

owncloud 虛擬主機:

server {
   listen 80;
   server_name cloud.spooky4672.me;
   return 301 https://$server_name$request_uri;
}

server {
   listen 443 ssl;
   server_name cloud.spooky4672.me;

   #SSL
   ssl_certificate /etc/nginx/ssl/cloud/cloud.spooky4672_chain.pem;
   ssl_certificate_key /etc/nginx/ssl/cloud/key.pem;

   #LOGS
   access_log off;
   error_log /var/log/nginx/owncloud-error.log;

   location / {
           proxy_pass http://local_ip;
   }
}

代理.conf

   proxy_redirect          off;
   proxy_set_header        Host            $host;
   proxy_set_header        X-Real-IP       $remote_addr;
   proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
   client_max_body_size    10m;
   client_body_buffer_size 128k;
   client_header_buffer_size 64k;
   proxy_connect_timeout   90;
   proxy_send_timeout      90;
   proxy_read_timeout      90;
   proxy_buffer_size   16k;
   proxy_buffers       32   16k;
   proxy_busy_buffers_size 64k;

在 StackOverflow 上回答

https://stackoverflow.com/questions/17932569/can-not-upload-big-files-with-nginx-reverse-proxyssl-negotiation-and-tomcat

client_max_body_size 1000m;

另請查看 http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size

並嘗試proxy_max_temp_file_size 0

引用自:https://unix.stackexchange.com/questions/241369