Install
Server optimization
If you use the official Docker image
It comes optimized. There is nothing on this page you need to apply to it:
- PHP and Apache are built from source for the image, with only the modules FileRun uses. Apache runs the event MPM and talks to PHP-FPM over a Unix socket.
- The PHP opcache is enabled, and the realpath cache is raised.
- File downloads are handed to Apache with
X-Sendfile, instead of being streamed through PHP. - Static files are served with a long cache lifetime, and connections are kept alive.
The one thing the image leaves out is the compression described below: it carries no compression module. An installation running from the image is normally reached through a reverse proxy, and compressing at the proxy is what the next section recommends in that case anyway. If you publish the container directly, without a proxy in front of it, nothing is compressed.
Compress HTTP text output
Do not configure this in the FileRun's HTTP server if it is proxied.
If you are using a proxy, you need to configure this in the proxy server, so that only communication between the proxy server and the client is being compressed.
Apache
Deflate/Gzip
Load the compression module:
1#Load Deflate module
2LoadModule deflate_module modules/mod_deflate.so
3# DeflateAlterETag NoChange #optional, as Nextcloud supports this
Enable for the FileRun site:
1<IfModule mod_deflate.c>
2AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
3</IfModule>
Brotli
1#Load Brotli module
2LoadModule brotli_module modules/mod_brotli.so
3BrotliAlterETag NoChange
The BrotliAlterETag configuration is important so that e-tag headers do not get altered with the -br postfix, breaking the desktop sync protocol.
Hoping Nextcloud adds support also for Brotli-encoded content at some point: https://github.com/nextcloud/desktop/blob/master/src/libsync/helpers.cpp#L22
Enable for the FileRun site:
1<IfModule mod_brotli.c>
2AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript application/json
3</IfModule>