Giter Club home page Giter Club logo

Comments (41)

Wonderfall avatar Wonderfall commented on August 20, 2024

Change the following code :
proxy_pass http://nextcloud; to proxy_pass http://nextcloud:8888;

I updated the Docker Hub description : https://hub.docker.com/r/wonderfall/nextcloud/
I had to change the listen port due to OS restrictions (non-root user cannot use port 80).

from dockerfiles.

 avatar commented on August 20, 2024

Great. That resolved it!

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

Nice to hear that!

from dockerfiles.

 avatar commented on August 20, 2024

Sorry for reposting here
but i found that big files are causing another issue
19.09.16 23:12:10, 06_Shared/xxx.dmg,/Volumes/Daten/Hannes/nextcloud,Error downloading https://nextcloud.mydomain.com/remote.php/webdav/06_Shared/xxx.dmg-chunking-2051989783-625-623 - server replied: Gateway Time-out

is it because of my nginx reverseproxy settings ?
Sorry - feeling that i am the only one that has questions. maybe i am to dumb ;P

EDIT:
while uploading and the filesize was 6GB

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

Can you paste the content of the following files (in the container) ?

  • /tmp/ngx_error.log
  • /var/log/php7/error.log

Thanks!

from dockerfiles.

 avatar commented on August 20, 2024

php7/error.log is empty

ngx_error.log

cat /tmp/ngx_error.log
2016/09/20 08:32:37 [error] 18#0: *352 rewrite or internal redirection cycle while internally redirecting to "/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/apps/files/core/search/templates/part.results.html", client: 172.17.0.5, server: , request: "GET /apps/files/core/search/templates/part.results.html HTTP/1.0", host: "nextcloud.mydomain.com"
2016/09/20 08:32:37 [error] 17#0: *364 rewrite or internal redirection cycle while internally redirecting to "/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/apps/files/core/img/actions/toggle-pictures.svg", client: 172.17.0.5, server: , request: "GET /apps/files/core/img/actions/toggle-pictures.svg HTTP/1.0", host: "nextcloud.mydomain.com"
2016/09/20 08:32:37 [error] 17#0: *365 rewrite or internal redirection cycle while internally redirecting to "/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/apps/files/undefined/img/notifications.svg", client: 172.17.0.5, server: , request: "GET /apps/files/undefined/img/notifications.svg HTTP/1.0", host: "nextcloud.mydomain.com"
2016/09/20 08:35:37 [error] 18#0: *833 rewrite or internal redirection cycle while internally redirecting to "/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/nextcloud/index.php/core/preview.png", client: 172.17.0.5, server: , request: "GET /core/preview.png?file=%2FLokal%2FOS+X+El+Capitan+v10.11+%5BMAS%5D+%2815A284%29%2FOS_X_El_Capitan_15A284.dmg&c=6dc1ddfeb1e75e07d3bf50430fc457f4&x=32&y=32&forceIcon=0 HTTP/1.0", host: "nextcloud.mydomain.com"
2016/09/20 08:38:06 [error] 17#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'db_nextcloud' (111 "Connection refused") in /nextcloud/lib/private/DB/Connection.php:59
Stack trace:
#0 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /nextcloud/lib/private/DB/Connection.php(142): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\...
PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'db_nextcloud' (111 "Connection refused") in /nextcloud/lib/private/DB/Connection.php:59
Stack trace:
#0 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /nextcloud/lib/private/DB/Connection.php(142): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172):
2016/09/20 08:38:06 [error] 17#0: *3 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'db_nextcloud' (111 "Connection refused") in /nextcloud/lib/private/DB/Connection.php:59
Stack trace:
#0 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /nextcloud/lib/private/DB/Connection.php(142): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\...
PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'db_nextcloud' (111 "Connection refused") in /nextcloud/lib/private/DB/Connection.php:59
Stack trace:
#0 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /nextcloud/lib/private/DB/Connection.php(142): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172):

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

The ngx_error.log looks like a database problem which should be fixed but I don't think it causes the problem with the download.

I guess it has more todo with a proxy and the php configuration. As "Gateway Timeout" says a process, maybe the php process, has taken too long time, so the webserver, maybe nginx, thought there won't be any response soon and it closed the connection.

I figured out that in the php configuration file the option request_terminate_timeout was set to 1200 which means 20 minutes.
But there's also max_execution_time set to 3 hours.
In the nginx config the same limit (of 20 minutes) is set.

Do you remember how long it took to upload the file or after which amount of time you got the response/error?


Btw.: you should also increase the upload_max_size for the php configuration. You increased the maximum for nginx only (client_max_body_size) this will allow nginx to handle 40960M big files but php won't use them when they are bigger than 10G (check here and here). You can easily fix that by setting the environment variable UPLOAD_MAX_SIZE of the nextcloud setup in your docker-compose file.

from dockerfiles.

 avatar commented on August 20, 2024

i setup a error log in my nginx conf
nginx nectcloud.error.log
i guess this makes more sense now
2016/09/20 10:34:23 [error] 13#13: *1 readv() failed (104: Connection reset by peer) while reading upstream, client: 80.152.253.93, server: nextcloud.hannesmueller.com, request: "GET /remote.php/webdav/Lokal/XXX.dmg?downloadStartSecret=7yymfqws68j2a7kuefa5g66r HTTP/2.0", upstream: "http://172.17.0.7:8888/remote.php/webdav/Lokal/XXX.dmg?downloadStartSecret=7yymfqws68j2a7kuefa5g66r", host: "nextcloud.hannesmueller.com"

i guess it was approx 20min.

from dockerfiles.

 avatar commented on August 20, 2024

i'm now running a test with increasedfastcgi_read_timeout

BTW:
The database Error was occuring from a failstart of my DB this morning :)
so no worries :)

from dockerfiles.

 avatar commented on August 20, 2024

Problem still persist with higher fastcgi_read_timeout

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

Increase both request_terminate_timeout (php-fpm.conf) and fastcgi_read_timeout (container + reverse proxy) and tell us if it works

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

Setting the php value to E_ALL would be helpfull, too.

Edit the php-fpm.conf and add:

php_admin_value[error_reporting] = E_ALL

Then check your /var/log/php7/error.log again after the upload fails.

from dockerfiles.

 avatar commented on August 20, 2024

okay. did everthing u said. no changes.
also i cant download files bigger than >1GB.
it stops exactly at 1024mb

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

Did you check /var/log/php7/error.log like @jdoubleu said? This can be helpful.
Otherwise, I don't have any idea. I don't use big files so I can't confirm I can reproduce it (if someone else can confirm it'd be nice), I'll look into it at the end of the week since I'm very busy.

from dockerfiles.

 avatar commented on August 20, 2024
root@NAS:~/.nginx/htdocs# docker exec -it nextcloud sh
/ # nano /var/log/php7/error.log
sh: nano: not found
/ # cat /var/log/php7/error.log
[20-Sep-2016 08:32:29] NOTICE: fpm is running, pid 15
[20-Sep-2016 08:32:29] NOTICE: ready to handle connections
[20-Sep-2016 08:38:05] NOTICE: fpm is running, pid 16
[20-Sep-2016 08:38:05] NOTICE: ready to handle connections
[20-Sep-2016 08:39:57] NOTICE: fpm is running, pid 15
[20-Sep-2016 08:39:57] NOTICE: ready to handle connections
[20-Sep-2016 08:44:25] NOTICE: fpm is running, pid 16
[20-Sep-2016 08:44:25] NOTICE: ready to handle connections
[20-Sep-2016 11:27:41] NOTICE: fpm is running, pid 16
[20-Sep-2016 11:27:41] NOTICE: ready to handle connections
[20-Sep-2016 16:50:37] NOTICE: fpm is running, pid 14
[20-Sep-2016 16:50:37] NOTICE: ready to handle connections
[21-Sep-2016 07:59:22] NOTICE: fpm is running, pid 16
[21-Sep-2016 07:59:22] NOTICE: ready to handle connections
cat /etc/php7/php-fpm.conf
[global]
daemonize = no

[www]
listen = /tmp/php-fpm.sock
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
request_terminate_timeout = 10800
env[PATH] = /usr/local/bin:/usr/bin:/bin
php_admin_value[post_max_size] = 40G
php_admin_value[upload_max_filesize] = 40G
php_admin_value[max_execution_time] = 10800
php_admin_value[max_input_time] = 1200
php_admin_value[error_reporting] = E_ALL

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

Hm okay, seems normal. I'm going to investigate this too at the end of the week.

Are there any other limitations which may cause the problems? For example your provider which blocks, for some reason, some connections via the firewall?


Another flaw may be php reaching it's memory limit. Here are more information about it.

from dockerfiles.

 avatar commented on August 20, 2024

found this in my logs
Uncaught Error: Class 'OCP\Lock\ILockingProvider' not found in /nextcloud/lib/private/Files/View.php:1152 Stack trace: #0 [internal function]: OC\Files\View->OC\Files\{closure}() #1 /nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php(109): call_user_func(Object(Closure)) #2 [internal function]: Icewind\Streams\CallbackWrapper->stream_close() #3 {main} thrown at /nextcloud/lib/private/Files/View.php#1152

from dockerfiles.

 avatar commented on August 20, 2024

i guess that has n omeaning :)

but i also get this at my nginx reverse proxy error.log
2016/09/25 13:33:40 [error] 14#14: *5 upstream prematurely closed connection while reading upstream, client: 130.187.59.214, server: nextcloud.xxx.com, request: "GET /remote.php/webdav/07_Studium/07_Bachelor/Praktisch.rar?downloadStartSecret=3elyzqbww05kyajkymd1ud6lxr HTTP/2.0", upstream: "http://172.17.0.5:8888/remote.php/webdav/07_Studium/07_Bachelor/Praktisch.rar?downloadStartSecret=3elyzqbww05kyxxxymd1ud6lxr", host: "nextcloud.xxx.com"

and its extactly stopping at 1024MiB

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

I'm getting the same error now but only after uploading the file. So it seems like I've successfully uploaded the file but after the upload completed it complains about 504 Gateway Time-out.

I guess it has something todo with the php configuration. There are many options (e.g. upload_max_size, post_max_size, etc.) which need to set up correctly (have a look at this).
I'm going to play around with them but it takes long to debug this (bad internet connection).

from dockerfiles.

 avatar commented on August 20, 2024

i would like to test with different connection_pool_size in my nginx settings (sites-enabled)
but when i change - nginx docker doesnt start up and givey me this error
cat /sites-enabled/nginx.conf

server {
  listen 8000;
  server_name nextcloud.mydomain.com;
  #rewrite ^ https://nextcloud.mydomain.com$request_uri? permanent;
  return 301 https://$host$request_uri;
}

server {

  listen 4430 ssl http2;
  server_name nextcloud.mydomain.com;
  client_max_body_size 10240;
  connection_pool_size 10G;
  ssl_certificate /certs/nextcloud/fullchain.pem;        # path to your cacert.pem
  ssl_certificate_key /certs/nextcloud/privkey.pem;      # path to your privkey.pem

  include /conf.d/ssl_params.conf;
  include /conf.d/headers.conf;

  access_log      /var/log/nginx/nextcloud.access.log;
  error_log       /var/log/nginx/nextcloud.error.log;
  location / {
    proxy_pass http://nextcloud:8888;
    include /conf.d/proxy-params.conf;
    fastcgi_read_timeout 10800;
  }
}

i get this

root@NAS:~# docker restart nginx
nginx
root@NAS:~# docker logs nginx
nginx: [emerg] "connection_pool_size" directive invalid value in /sites-enabled/nginx.conf:13

where do i need to set the connection_pool_size 10G; ??

cat /conf.d/proxy-params.conf
proxy_set_header        Host                 $host;
proxy_set_header        X-Real-IP            $remote_addr;
proxy_set_header        X-Forwarded-For      $proxy_add_x_forwarded_for;
proxy_set_header        X-Remote-Port        $remote_port;
proxy_set_header        X-Forwarded-Proto    $scheme;
proxy_redirect          off;

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

As described in the official nginx documentation you can set it in server or http context.

I also thought this problem could be caused by some memory limits of the proxies, that they cannot buffer large files due to limitations but the log files imply something different.

Maybe we should create a php file in the container with:

<?
phpinfo();

to check which variables are set and which values they have.
Maybe we'll see something around 1024?

from dockerfiles.

 avatar commented on August 20, 2024

cat /var/log/nginx/error.log
2016/09/26 11:10:46 [alert] 10#10: unlink() "/var/run/nginx.pid" failed (13: Permission denied)
does this has something to do with ?

from dockerfiles.

 avatar commented on August 20, 2024

i dont think its the nginx reverse_proxy.
other webservices (emby also as reverseproxy) are allowing downloading files bigger than >1gb

could it be, the maria-db is broken ?

from dockerfiles.

xataz avatar xataz commented on August 20, 2024

cat /var/log/nginx/error.log
2016/09/26 11:10:46 [alert] 10#10: unlink() "/var/run/nginx.pid" failed (13: Permission denied)
does this has something to do with ?

I can't try actually, but can you try add there parameters on Dockerfile :

--pid-path=/tmp/nginx.pid \
--lock-path=/tmp/nginx.lock \

EDIT

After try, it's work for me :

docker@default:~$ docker run -d --name nginx -P wonderfall/nginx
6f96a74f2e7f967efa652c757c2d3b5cdaf143872829ea1a74da108b78764312
docker@default:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                              NAMES
6f96a74f2e7f        wonderfall/nginx    "run.sh"            2 minutes ago       Up 2 minutes        0.0.0.0:32771->4430/tcp, 0.0.0.0:32770->8000/tcp   nginx
docker@default:~$ docker exec -ti nginx cat /var/log/nginx/error.log
docker@default:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                              NAMES
6f96a74f2e7f        wonderfall/nginx    "run.sh"            2 minutes ago       Up 2 minutes        0.0.0.0:32771->4430/tcp, 0.0.0.0:32770->8000/tcp   nginx
docker@default:~$ docker exec -ti nginx cat /var/log/nginx/error.log
docker@default:~$ docker exec -ti nginx ps aux
PID   USER     TIME   COMMAND
    1 991        0:00 /sbin/tini -- nginx
    7 991        0:00 nginx: master process nginx
    8 991        0:00 nginx: worker process
   62 root       0:00 ps aux
docker@default:~$

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

I don't think it's related, and @hardware has already fixed the problem : 87b57a7

from dockerfiles.

 avatar commented on August 20, 2024

can someone please send his reverse_proxy nextcloud.conf for nginx ?
Maybe i am missing something ?

from dockerfiles.

 avatar commented on August 20, 2024

although this is my nextcloud.conf

server {
  listen 8000;
  server_name nextcloud.mydomain.com;
  return 301 https://$host$request_uri;
}

server {
  listen 4430 ssl http2;
  server_name nextcloud.mydomain.com;

  ssl_certificate /certs/nextcloud/fullchain.pem;
  ssl_certificate_key /certs/nextcloud/privkey.pem;

  include /conf.d/ssl_params.conf;
  include /conf.d/headers.conf;

  location / {
    proxy_pass http://nextcloud:8888;
    include /conf.d/proxy-params.conf;
    client_max_body_size 10G;
  }
}

and i get securitywarning in administration site

Der „X-XSS-Protection“-HTTP-Header ist nicht so konfiguriert, dass er „1; mode=block“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.
Der „X-Content-Type-Options“-HTTP-Header ist nicht so konfiguriert, dass er „nosniff“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.
Der „X-Frame-Options“-HTTP-Header ist nicht so konfiguriert, dass er „SAMEORIGIN“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

As said in the README, you shouldn't add security headers as they're already included in Nextcloud. In other words, you can remove this line to get rid of the security warnings : include /conf.d/headers.conf;.

Otherwise your nextcloud.conf looks good to me.

from dockerfiles.

 avatar commented on August 20, 2024

jquery?
i get this error in Chrome Console when i inspect and reload the site
Failed to parse SourceMap: https://nextcloud.mydomain.com/core/vendor/jquery/dist/jquery.min.map

but seems to be there

~/.nginx/sites-enabled# docker exec -it nextcloud sh
/ # find / -name jquery.min.map
/nextcloud/core/vendor/jquery/dist/jquery.min.map
/nextcloud/updater/pub/js/vendor/jquery.min.map
/apps2/mail/js/vendor/jquery/dist/jquery.min.map

nvmnd
https://help.nextcloud.com/t/jquery-min-map-unable-to-load/2567

from dockerfiles.

 avatar commented on August 20, 2024

i guess i found the error

Error PHP Uncaught Error: Class 'OCP\Lock\ILockingProvider' not found in /nextcloud/lib/private/Files/View.php:1152 Stack trace: #0 [internal function]: OC\Files\View->OC\Files\{closure}() #1 /nextcloud/3rdparty/icewind/streams/src/CallbackWrapper.php(109): call_user_func(Object(Closure)) #2 [internal function]: Icewind\Streams\CallbackWrapper->stream_close() #3 {main} thrown at /nextcloud/lib/private/Files/View.php#1152 a few seconds ago

from dockerfiles.

 avatar commented on August 20, 2024

updated to daily - same problem

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

I played around with some variables and for me it works well. I also found this which might be helpful.

I'm using the default nginx config from this project.
Then I changed the php-fpm.conf:

[global]
daemonize = no

[www]
listen = /tmp/php-fpm.sock
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
request_terminate_timeout = 0
env[PATH] = /usr/local/bin:/usr/bin:/bin
php_admin_value[post_max_size] = 16400M
php_admin_value[upload_max_filesize] = 16G
php_admin_value[max_execution_time] = 10800
php_admin_value[max_input_time] = 3600

Note the request_terminate_timeout = 0 which deactivates it and the php_admin_value[post_max_size] = 16400M (instead of 16GB).

My nginx reverse proxy config of this host:

client_max_body_size 16400M;
sendfile on;
default_type  application/octet-stream;
keepalive_timeout 15;
keepalive_disable msie6;
keepalive_requests 100;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;

proxy_set_header Authorization $http_authorization;
proxy_pass_header  Authorization;

I don't know which of those caused the problems but deactivating request_terminate_timeout is a good choice here I guess.
The increasing of the max_input_time should also be done for php because some people may have slower internet connections. For nginx or the proxy this isn't necessary because nextcloud sends heartbeat requests.


I created a MR (#42) but I don't know how to handle the php_admin_value[post_max_size] change. Maybe there could be some calculations and replacement in the Dockerfile?

from dockerfiles.

 avatar commented on August 20, 2024

did everything u said. no change.
u know what - i backup my files and resetup from ground up.
Can you confirm that these are good compose-settings ?

nginx:
  image: wonderfall/nginx
  container_name: nginx
  links:
    - nextcloud:nextcloud
    - php
  ports:
    - "80:8000"
    - "443:4430"
  volumes:
    - /etc/localtime:/etc/localtime
    - /root/.nginx/sites-enabled:/sites-enabled
    - /root/.nginx/conf:/conf.d
    - /root/.nginx/log:/var/log/nginx
    - /root/.nginx/certs:/certs
    - /root/.nginx/htdocs:/www

php:
    container_name: php
    image: php:7-fpm
    volumes:
      - /root/.nginx/htdocs:/www

nextcloud:
    image: wonderfall/nextcloud:daily
    container_name: nextcloud
    links:
      - db_nextcloud:db_nextcloud
    environment:
      - UID=1000
      - GID=1000
      - UPLOAD_MAX_SIZE=20G
      - APC_SHM_SIZE=256M
      - OPCACHE_MEM_SIZE=256
      - CRON_PERIOD=15m
    volumes:
      - /etc/localtime:/etc/localtime
      - /media/19ad4901-a651-4001-9306-425956e2c501/Cloud/data:/data
      - /media/19ad4901-a651-4001-9306-425956e2c501/Cloud/config:/config
      - /media/19ad4901-a651-4001-9306-425956e2c501/Cloud/apps:/apps2

nextcloud_db:
    image: mariadb:10
    volumes:
      - /media/19ad4901-a651-4001-9306-425956e2c501/Cloud_db:/var/lib/mysql
    container_name: nextcloud_db
    environment:
      - MYSQL_ROOT_PASSWORD=secret
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=secret

nextcloud_collabora:   
    image: collabora/code
    tty: true
    container_name: nextcloud_collabora
    ports:
      - "192.168.0.107:9980:9980"
    environment:
      - domain=nextcloud\.mydomain\.com
    cap_add:
      - MKNOD

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

Why are you using a separate php-fpm container? And are there other sites running on your host? Because the Wonderfall/nextcloud container already ships a nginx webserver with a php-fpm backend.
Also your setup says nothing about the configuration of these components.

from dockerfiles.

 avatar commented on August 20, 2024

i have regular website stuff running on my host. thats why i have php running on a extra docker.

made complete reinstall.
deleted db and volumes. still the same issue :(

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

Okay, tested again for larger files (> 2GB) and it's going to break again.

The error pop up still says Gateway Timed Out but this time I followed the 504 error and the API responded with The upload path couldn't be set.
I checked the php configuration by inspecting all variables set usign phpinfo() and there isn't any upload_tmp_dir set. I wonder why it's working for small files but not for large ones (if this is the bug).

This article says that also memory_limit should be larger than post_max_size. But I guess this is not an option.

May you could test it again with memory_limit set to -1(!)? It's very hard to test for me, because I have a slow connection.

I would also suggest to change the title, e.g. Error after uploading too large files (504).

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

Yeah me too, can't test with big files with my actual connection...
I thought about memory_limit too. If you (or @Gutz-Pilz) could test, that'd be very helpful.

If no solution is found in the next days, I'll report the bug directly to Nextcloud.

from dockerfiles.

jdoubleu avatar jdoubleu commented on August 20, 2024

I got the idea to test it locally (e.g. with the Docker Toolbox) where your internet connection doesn't matter.

I want to share some insights, while I'm still investigating.

I created a simple setup using this docker-compose.yml file:

version: '2'

services:
  nextcloud:
   image: wonderfall/nextcloud
   ports:
     - "8080:8888"
   volumes:
     - "$PWD/volumes/config:/config"
   links:
     - mysql:mysql
   environment:
     - UID=1000
     - GID=1000

  mysql:
    image: mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      -  MYSQL_DATABASE=nextcloud

This is the basic setup as it is served by @Wonderfall. And it works!
I haven't overwritten the default limit of 10GB and so far a 2.1GB file works. Even a 8GB file works but when it comes to the limit it's a bit tricky and confusing:
A 10GB file, which is ~9.3GiB, works but not a 10GiB file doesn't. When trying to upload the 10GiB file the same error appears like we had behind the proxy.

So far I think there is a problem with the reverse proxy.

Using this nginx proxy config (default from jwilder/nginx-proxy) it doesn't work. It breaks at some point, maybe 1GB, caused by default settings of nginx.

...
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
# Mitigate httpoxy attack (see README for details)
proxy_set_header Proxy "";
...
upstream 192.168.99.100 {
                ## Can be connect with "nextcloud_default" network
            # nextcloud_nextcloud_1
            server 172.18.0.3:8888;
}
server {
    server_name 192.168.99.100;
    listen 80 ;
    access_log /var/log/nginx/access.log vhost;
    location / {
        proxy_pass http://192.168.99.100;
    }
}

I've added client_max_body_size 10G; to my server block in reverse proxy conf and now I'm getting error while writing file to harddrive errors from nextcloud.
Maybe some buffer problems.
Note: Maybe this will happen, because the file will be buffered twice: first from the reverse proxy and second from php in the nextcloud container. My VM only has 10GB of free storage so I can upload a maximum of 5GB. I've tested a 4GiB file and this works. So probably client_max_body_size 10G; was the solving. But I mean I've already tried that!
I've also found some more configs for the reverse proxy.

There could also be a problem with slow uploads (e.g. to a remote server) with a slow connection which might cause some timeouts?
This would be very bad for debugging.

from dockerfiles.

Wonderfall avatar Wonderfall commented on August 20, 2024

Any update on this?

from dockerfiles.

 avatar commented on August 20, 2024

With the following docker containers (just the default settings, no modifications):

  • nginx
  • jwilder/docker-gen
  • jrcs/letsencrypt-nginx-proxy-companion
  • wonderfall/nextcloud

I've managed to fix my problem with uploading big files, i got the "Entity(?) to big" error in the webui.

Add the line:

client_max_body_size 0;

in nginx.tmpl file right below the line(59):

proxy_http_version 1.1;

Then restarted the nginx, docker-gen and nextcloud container, and now i can successfully upload the test file with a size of 65 MB.

from dockerfiles.

mga0 avatar mga0 commented on August 20, 2024

project version: 9709a86

I ran into a similar problem having "server replies: Gateway Time-out" during syncing with the nextcloud client 2.3.2 with a slow connection for even the smallest files. I used the suggested nginx proxy configuration from Readme.md@14ab668 as the following

server {
  listen 8000;
  server_name example.com;
  return 301 https://$host$request_uri;
}

server {
  listen 4430 ssl http2;
  server_name example.com;

  ssl_certificate /certs/example.com.crt;
  ssl_certificate_key /certs/example.com.key;

  include /etc/nginx/conf/ssl_params.conf;

  client_max_body_size 10G; # change this value it according to $UPLOAD_MAX_SIZE

  location / {
    proxy_pass http://nextcloud:8888;
    include /etc/nginx/conf/proxy_params;
  }
}

I resolved the issue for myself by extending the location block using the information from https://www.scalescale.com/tips/nginx/504-gateway-time-out-using-nginx/

proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
send_timeout                600;

Maybe this adaption could also be useful for the master, but I'm not an expert on what I did there. @Wonderfall
Thank you for your great work and effort folks.

from dockerfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.