Nextcloud on Raspberry Pi with SSL, Docker, PostgreSQL & Cloudflare Zero Trust
Unlock the Full Power of Nextcloud on Raspberry Pi
SSL, Advanced App Support, High-Performance PostgreSQL, and Cloudflare Zero Trust Integration!
Take your self-hosted cloud to the next level with a secure, optimized, and extensible setup tailored for Raspberry Pi power users.
📝 Changelog
- 08/24/2024 — Added script for easier setup of:
- SSL certificates
- Nginx configuration
- Docker environment preparation
- 03/20/2024 — Initial release
Prerequisites:
- Raspberry Pi Hardware:
- Raspberry Pi board (e.g., Raspberry Pi 4 Model B).
- MicroSD card (preferably 16GB or larger) for Raspberry Pi OS installation.
- Power supply compatible with your Raspberry Pi model.
- Raspberry Pi OS Installation:
- Download the latest Raspberry Pi OS Lite or Raspberry Pi OS with a desktop from the official Raspberry Pi website.
- Flash the Raspberry Pi OS image onto the microSD card using a tool like Raspberry Pi Imager or balenaEtcher.
- Insert the microSD card into your Raspberry Pi board and power it on.
- Follow the on-screen instructions to complete the initial setup of Raspberry Pi OS, including setting up Wi-Fi, expanding the filesystem, and configuring localization settings if necessary.
- Ensure your Raspberry Pi is connected to the internet via Ethernet or Wi-Fi.
- Installing Docker:
- Follow the official Docker installation guide for Raspberry Pi to install Docker on your Raspberry Pi OS. This typically involves adding Docker’s official repository to your package manager and installing Docker packages using apt.
- Installing Docker Compose:
- Follow the official Docker Compose installation guide to install Docker Compose on your Raspberry Pi OS.
File Structure:
1
2
3
4
5
6
7
8
9
10
11
12
/root/nextcloud/
│
├── Dockerfile.app
├── docker-compose.yml
├── db.env
├── .env
├── nginx.conf
└── certs/
├── myCA.pem
├── mycloud.example.com.crt
├── mycloud.example.com.key
└── dhparam.pem
Quick Setup Instructions
Follow these steps for a quick setup of your Nextcloud environment. This script will automatically generate necessary certificates, configure Nginx, create essential environment files, and set up required directories.
1. Create Docker Volume
Run the following command to create the Docker volume named nextcloud_sslcerts:
1
sudo docker volume create nextcloud_sslcerts
This command creates a Docker volume where your SSL/TLS certificates will be stored.
2. Save and Run Setup Script
Save the following script as setup-nextcloud.sh:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
#!/bin/bash
# Determine the home directory
HOME_DIR="$HOME"
# Define the Docker volume name (assumes 'nextcloud_sslcerts' volume exists)
VOLUME_NAME="nextcloud_sslcerts"
# Get the Docker volume path
DOCKER_VOLUME_PATH=$(docker volume inspect "$VOLUME_NAME" --format '{{ .Mountpoint }}')
# Check if the Docker volume path was obtained successfully
if [ -z "$DOCKER_VOLUME_PATH" ]; then
echo "Error: Docker volume '$VOLUME_NAME' not found. Please create the volume before running this script."
exit 1
fi
# Define directories and files
CERTS_DIR="$HOME_DIR/nextcloud/certs"
NGINX_CONF="$HOME_DIR/nextcloud/nginx.conf"
DOCKERFILE_APP="$HOME_DIR/nextcloud/Dockerfile.app"
DB_ENV="$HOME_DIR/nextcloud/db.env"
ENV_FILE="$HOME_DIR/nextcloud/.env"
DOCKER_VOLUME_CERTS_DIR="$DOCKER_VOLUME_PATH"
# Create directories if they do not exist
mkdir -p "$CERTS_DIR"
mkdir -p "$HOME_DIR/nextcloud"
mkdir -p "$DOCKER_VOLUME_CERTS_DIR"
# Generate SSL/TLS Certificates and Diffie-Hellman Parameters
cd "$CERTS_DIR" || exit
# Generate RSA private key if it doesn't already exist
if [ ! -f "mycloud.example.com.key" ]; then
openssl genrsa -out mycloud.example.com.key 2048
echo "Generated RSA private key: mycloud.example.com.key"
else
echo "RSA private key already exists: mycloud.example.com.key"
fi
# Generate self-signed CA certificate if it doesn't already exist
if [ ! -f "myCA.pem" ]; then
openssl req -x509 -new -nodes -key mycloud.example.com.key -sha256 -days 365 -out myCA.pem -subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=MyCA"
echo "Generated self-signed CA certificate: myCA.pem"
else
echo "Self-signed CA certificate already exists: myCA.pem"
fi
# Generate Certificate Signing Request if it doesn't already exist
if [ ! -f "mycloud.example.com.csr" ]; then
openssl req -new -key mycloud.example.com.key -out mycloud.example.com.csr -subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=mycloud.example.com"
echo "Generated Certificate Signing Request: mycloud.example.com.csr"
else
echo "Certificate Signing Request already exists: mycloud.example.com.csr"
fi
# Sign the certificate with the CA certificate if it doesn't already exist
if [ ! -f "mycloud.example.com.crt" ]; then
openssl x509 -req -in mycloud.example.com.csr -CA myCA.pem -CAkey mycloud.example.com.key -CAcreateserial -out mycloud.example.com.crt -days 365 -sha256
echo "Signed certificate with CA: mycloud.example.com.crt"
else
echo "Signed certificate already exists: mycloud.example.com.crt"
fi
# Generate Diffie-Hellman parameters if it doesn't already exist
if [ ! -f "dhparam.pem" ]; then
openssl dhparam -out dhparam.pem 2048
echo "Generated Diffie-Hellman parameters: dhparam.pem"
else
echo "Diffie-Hellman parameters already exist: dhparam.pem"
fi
# Create nginx.conf file if it doesn't already exist
if [ ! -f "$NGINX_CONF" ]; then
cat <<EOF > "$NGINX_CONF"
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 10024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" '
'\$status \$body_bytes_sent "\$http_referer" '
'"\$http_user_agent" "\$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
server_tokens off;
keepalive_timeout 65;
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
upstream php-handler {
server app:9000;
}
server {
listen 80;
client_max_body_size 512M;
fastcgi_buffers 64 4K;
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-XSS-Protection "1; mode=block" always;
fastcgi_hide_header X-Powered-By;
root /var/www/html;
index index.php index.html /index.php\$request_uri;
location = / {
if ( \$http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/\$is_args\$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ^~ /.well-known {
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files \$uri \$uri/ =404; }
location /.well-known/pki-validation { try_files \$uri \$uri/ =404; }
return 301 /index.php\$request_uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
location ~ \.php(?:$|/) {
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php\$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set \$path_info \$fastcgi_path_info;
try_files \$fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param PATH_INFO \$path_info;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|svg|gif)$ {
try_files \$uri /index.php\$request_uri;
expires 6M;
access_log off;
}
location ~ \.woff2?$ {
try_files \$uri /index.php\$request_uri;
expires 7d;
access_log off;
}
location /remote {
return 301 /remote.php\$request_uri;
}
location / {
try_files \$uri \$uri/ /index.php\$request_uri;
}
}
server {
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
client_max_body_size 512M;
fastcgi_buffers 64 4K;
root /var/www/html;
index index.php index.html /index.php\$request_uri;
location = / {
if ( \$http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/\$is_args\$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ^~ /.well-known {
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files \$uri \$uri/ =404; }
location /.well-known/pki-validation { try_files \$uri \$uri/ =404; }
return 301 /index.php\$request_uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
location ~ \.php(?:$|/) {
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php\$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set \$path_info \$fastcgi_path_info;
try_files \$fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param PATH_INFO \$path_info;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|svg|gif)$ {
try_files \$uri /index.php\$request_uri;
expires 6M;
access_log off;
}
location ~ \.woff2?$ {
try_files \$uri /index.php\$request_uri;
expires 7d;
access_log off;
}
location /remote {
return 301 /remote.php\$request_uri;
}
location / {
try_files \$uri \$uri/ /index.php\$request_uri;
}
}
}
EOF
echo "Created nginx configuration file: $NGINX_CONF"
else
echo "nginx configuration file already exists: $NGINX_CONF"
fi
# Create Dockerfile.app file if it doesn't already exist
if [ ! -f "$DOCKERFILE_APP" ]; then
cat <<EOF > "$DOCKERFILE_APP"
# Use the official Nextcloud image as a base image
FROM nextcloud:stable-fpm-alpine
# Install dependencies, including necessary development libraries
RUN apk update && \
apk add --no-cache \
build-base \
cmake \
git \
imagemagick-dev \
ffmpeg \
nodejs \
npm \
util-linux \
git \
g++ \
ghostscript \
libx11-dev \
sudo \
nano \
samba-client \
bzip2-dev \
zlib-dev \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
freetype-dev
# Install PHP extensions
RUN docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp && \
docker-php-ext-install gd mysqli pdo pdo_mysql opcache bz2
# Install imagick using pecl only if it's not already installed
RUN if ! pecl list | grep -q imagick; then \
pecl install imagick && \
docker-php-ext-enable imagick; \
fi
# Set environment variables
ENV NODE_PATH /usr/bin/node
ENV NICE_CMD /usr/bin/nice
# Install dlib and pdlib
RUN git clone https://github.com/davisking/dlib.git && \
cd dlib/dlib && mkdir build && cd build && cmake -DBUILD_SHARED_LIBS=ON .. && make && make install
RUN git clone https://github.com/goodspb/pdlib.git /usr/src/php/ext/pdlib && \
docker-php-ext-install pdlib
# Cleanup unnecessary packages
RUN apk del build-base cmake git && \
rm -rf /var/cache/apk/*
EOF
echo "Created Dockerfile.app: $DOCKERFILE_APP"
else
echo "Dockerfile.app already exists: $DOCKERFILE_APP"
fi
# Create db.env file if it doesn't already exist
if [ ! -f "$DB_ENV" ]; then
cat <<EOF > "$DB_ENV"
POSTGRES_PASSWORD=securepassword
POSTGRES_DB=nextcloud
POSTGRES_USER=nextcloud
EOF
echo "Created db.env file: $DB_ENV"
else
echo "db.env file already exists: $DB_ENV"
fi
# Create .env file if it doesn't already exist
if [ ! -f "$ENV_FILE" ]; then
cat <<EOF > "$ENV_FILE"
POSTGRES_VERSION=14-alpine
REDIS_VERSION=6.2-alpine
NGINX_VERSION=alpine
REDIS_PORT=6379
NGINX_PORT=8443
NEXTCLOUD_EXTDATA=/mnt/ad/nextcloud
PHP_MEMORY_LIMIT=2048M
EOF
echo "Created .env file: $ENV_FILE"
else
echo ".env file already exists: $ENV_FILE"
fi
# Copy SSL/TLS certificate files if they do not already exist
if [ ! -f "$DOCKER_VOLUME_CERTS_DIR/key.pem" ]; then
cp "$CERTS_DIR/mycloud.example.com.key" "$DOCKER_VOLUME_CERTS_DIR/key.pem"
echo "Copied key.pem to Docker volume path: $DOCKER_VOLUME_CERTS_DIR/key.pem"
else
echo "key.pem already exists in Docker volume path: $DOCKER_VOLUME_CERTS_DIR/key.pem"
fi
if [ ! -f "$DOCKER_VOLUME_CERTS_DIR/cert.pem" ]; then
cp "$CERTS_DIR/myCA.pem" "$DOCKER_VOLUME_CERTS_DIR/cert.pem"
echo "Copied cert.pem to Docker volume path: $DOCKER_VOLUME_CERTS_DIR/cert.pem"
else
echo "cert.pem already exists in Docker volume path: $DOCKER_VOLUME_CERTS_DIR/cert.pem"
fi
if [ ! -f "$DOCKER_VOLUME_CERTS_DIR/dhparam.pem" ]; then
cp "$CERTS_DIR/dhparam.pem" "$DOCKER_VOLUME_CERTS_DIR/dhparam.pem"
echo "Copied dhparam.pem to Docker volume path: $DOCKER_VOLUME_CERTS_DIR/dhparam.pem"
else
echo "dhparam.pem already exists in Docker volume path: $DOCKER_VOLUME_CERTS_DIR/dhparam.pem"
fi
2.1 Make the Script Executable
Run the following command to make the setup-nextcloud.sh script executable:
1
chmod +x /root/nextcloud/setup-nextcloud.sh
2.2 Run the Script
Execute the script to complete the setup:
1
/root/nextcloud/setup-nextcloud.sh
This script will automatically create the required directories, generate SSL certificates, configure Nginx, and prepare the environment for running Nextcloud.
Check the .env and db.env file and update NEXTCLOUD_EXTDATA variable with your external storage path if needed
3. Create docker-compose.yml
To simplify the management of your Nextcloud environment, create a docker-compose.yml file in the /root/nextcloud directory:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
version: '3'
services:
db:
image: postgres:${POSTGRES_VERSION:-alpine}
restart: always
volumes:
- db:/var/lib/postgresql/data:Z
env_file:
- db.env
environment:
- PUID=${PUID:-109}
- PGID=${PGID:-65534}
networks:
- proxy-tier
cache:
image: redis:${REDIS_VERSION:-6.2-alpine}
restart: always
ports:
- '${REDIS_PORT:-6379}:6379'
command: redis-server --save 20 1
volumes:
- cache:/data
networks:
- proxy-tier
app:
build:
context: .
dockerfile: ${APP_DOCKERFILE:-Dockerfile.app}
container_name: ${APP_CONTAINER_NAME:-nextcloud}
restart: always
volumes:
- nextcloud:/var/www/html:z
- ${NEXTCLOUD_EXTDATA:-/mnt/ad/nextcloud}:/extdata
- php-fpm:/usr/local/etc
- type: tmpfs
target: /tmp:exec
environment:
- POSTGRES_HOST=db
- REDIS_HOST=cache
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-2048M}
env_file:
- db.env
depends_on:
- db
- cache
devices:
- /dev/video10:/dev/video10
- /dev/video11:/dev/video11
- /dev/video12:/dev/video12
networks:
- proxy-tier
cron:
build:
context: .
dockerfile: ${APP_DOCKERFILE:-Dockerfile.app}
restart: always
volumes:
- nextcloud:/var/www/html:z
- ${NEXTCLOUD_EXTDATA:-/mnt/ad/nextcloud}:/extdata
- php-fpm:/usr/local/etc
- type: tmpfs
target: /tmp:exec
entrypoint: /cron.sh
depends_on:
- db
- cache
devices:
- /dev/video10:/dev/video10
- /dev/video11:/dev/video11
- /dev/video12:/dev/video12
environment:
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-2048M}
networks:
- proxy-tier
imaginary:
image: ${IMAGINARY_IMAGE:-ghcr.io/italypaleale/imaginary:master}
container_name: imaginary
restart: always
ports:
- '${IMAGINARY_PORT:-9000}:9000'
command: -enable-url-source
networks:
- proxy-tier
nginx-proxy:
image: nginx:${NGINX_VERSION:-alpine}
container_name: nginx-proxy
restart: always
ports:
- "${NGINX_PORT:-8443}:443"
volumes:
- sslcerts:/etc/nginx/ssl
- ./nginx.conf:/etc/nginx/nginx.conf
- nextcloud:/var/www/html:z,ro
networks:
- proxy-tier
depends_on:
- app
volumes:
db:
php-fpm:
nextcloud:
sslcerts:
cache:
driver: local
networks:
proxy-tier:
This docker-compose.yml file sets up services for Nextcloud, PostgreSQL, and Redis. It also uses Docker volumes to persist data and SSL certificates.
4. [Optional] Manual Setup Steps
Ignore Manual Setup Steps [1-7] Below if you have used the script above.
Manual Setup Steps [Hidden]
Step 1: Docker Compose Configuration
First, create a docker-compose.yml file with the following configuration:
Here /mnt/ad/nextcloud is the folder path of the external HDD in my Raspberry Pi. You can change this path.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
version: '3'
services:
db:
image: postgres:alpine
restart: always
volumes:
- db:/var/lib/postgresql/data:Z
env_file:
- db.env
environment:
- PUID=109
- PGID=65534
networks:
- proxy-tier
cache:
image: redis:6.2-alpine
restart: always
ports:
- '6379:6379'
command: redis-server --save 20 1
volumes:
- cache:/data
networks:
- proxy-tier
app:
#image: nextcloud:fpm-alpine
build:
context: .
dockerfile: Dockerfile.app
container_name: nextcloud
restart: always
volumes:
- nextcloud:/var/www/html:z
- /mnt/ad/nextcloud:/extdata
- php-fpm:/usr/local/etc
- type: tmpfs
target: /tmp:exec
environment:
- POSTGRES_HOST=db
- REDIS_HOST=cache
- PHP_MEMORY_LIMIT=2048M
env_file:
- db.env
depends_on:
- db
- cache
devices:
- /dev/video10:/dev/video10
- /dev/video11:/dev/video11
- /dev/video12:/dev/video12
networks:
- proxy-tier
cron:
#image: nextcloud:fpm-alpine
build:
context: .
dockerfile: Dockerfile.cron
restart: always
volumes:
- nextcloud:/var/www/html:z
- /mnt/ad/nextcloud:/extdata
- php-fpm:/usr/local/etc
- type: tmpfs
target: /tmp:exec
entrypoint: /cron.sh
depends_on:
- db
- cache
devices:
- /dev/video10:/dev/video10
- /dev/video11:/dev/video11
- /dev/video12:/dev/video12
environment:
- PHP_MEMORY_LIMIT=2048M
networks:
- proxy-tier
imaginary:
image: ghcr.io/italypaleale/imaginary:master
container_name: imaginary
restart: always
ports:
- '9000:9000'
command: -enable-url-source
nginx-proxy:
image: nginx:alpine
container_name: nginx-proxy
ports:
- "8443:443"
volumes:
- sslcerts:/etc/nginx/ssl
- ./nginx.conf:/etc/nginx/nginx.conf
- nextcloud:/var/www/html:z,ro
networks:
- proxy-tier
depends_on:
- app
volumes:
db:
php-fpm:
nextcloud:
sslcerts:
cache:
driver: local
networks:
proxy-tier:
Step 2: Dockerfile Configuration [Dockerfile.app]
Create a Dockerfile.app with the following content:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Use the official Nextcloud image as a base image
FROM nextcloud:stable-fpm-alpine
# Install build essentials
RUN apk update && \
apk add --no-cache build-base
# Install imagemagick-common and ffmpeg
RUN apk add --no-cache ffmpeg \
&& apk add --no-cache nodejs npm \
&& apk add --no-cache util-linux \
&& apk add --no-cache git g++ cmake ghostscript libx11-dev sudo nano
# Set the NODE_PATH environment variable to point to the Node.js binary
ENV NODE_PATH /usr/bin/node
ENV NICE_CMD /usr/bin/nice
RUN git clone https://github.com/davisking/dlib.git \
&& cd dlib/dlib \
&& mkdir build \
&& cd build \
&& cmake -DBUILD_SHARED_LIBS=ON .. \
&& make \
&& make install
RUN git clone https://github.com/goodspb/pdlib.git /usr/src/php/ext/pdlib
RUN docker-php-ext-install pdlib
# Install BZip2 library and development files
RUN apk add --no-cache bzip2-dev
# Install php-bz2
RUN docker-php-ext-install bz2
# Install smbclient
RUN apk add --no-cache samba-client
# Clean up unnecessary build dependencies
RUN apk del build-base cmake git
Step 3: Dockerfile Configuration [Dockerfile.cron]
Create a Dockerfile.cron with the following content:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Use the official Nextcloud image as a base image
FROM nextcloud:stable-fpm-alpine
# Install build essentials
RUN apk update && \
apk add --no-cache build-base
# Install imagemagick-common and ffmpeg
RUN apk add --no-cache ffmpeg \
&& apk add --no-cache nodejs npm \
&& apk add --no-cache util-linux \
&& apk add --no-cache git g++ cmake ghostscript libx11-dev sudo nano
# Set the NODE_PATH environment variable to point to the Node.js binary
ENV NODE_PATH /usr/bin/node
ENV NICE_CMD /usr/bin/nice
RUN git clone https://github.com/davisking/dlib.git \
&& cd dlib/dlib \
&& mkdir build \
&& cd build \
&& cmake -DBUILD_SHARED_LIBS=ON .. \
&& make \
&& make install
RUN git clone https://github.com/goodspb/pdlib.git /usr/src/php/ext/pdlib
RUN docker-php-ext-install pdlib
# Install BZip2 library and development files
RUN apk add --no-cache bzip2-dev
# Install php-bz2
RUN docker-php-ext-install bz2
# Install smbclient
RUN apk add --no-cache samba-client
# Clean up unnecessary build dependencies
RUN apk del build-base cmake git
Step 4: Generating SSL/TLS Certificates and Diffie-Hellman Parameters
Execute the following commands in your terminal to generate SSL/TLS certificates and Diffie-Hellman parameters:
You don’t have to write anything for the certificate generation, just press the enter key
1
2
3
4
5
6
7
8
9
10
11
12
13
cd ~
sudo mkdir nextcloud/certs
cd nextcloud/certs
sudo su
openssl genrsa -out mycloud.example.com.key 2048
openssl req -x509 -new -nodes -key mycloud.example.com.key -sha256 -days 365 -out myCA.pem
openssl req -new -key mycloud.example.com.key -out mycloud.example.com.csr
openssl x509 -req -in mycloud.example.com.csr -CA myCA.pem -CAkey mycloud.example.com.key -CAcreateserial -out mycloud.example.com.crt -days 365 -sha256
openssl dhparam -out dhparam.pem 2048
Step 5: Create a db.env file at /home/pi/nextcloud
1
2
3
POSTGRES_PASSWORD=somesecurepassword
POSTGRES_DB=nextcloud
POSTGRES_USER=nextcloud
Step 6: Create nginx.conf file at /home/pi/nextcloud
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 10024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
# Prevent nginx HTTP Server Detection
server_tokens off;
keepalive_timeout 65;
#gzip on;
upstream php-handler {
server app:9000;
}
server {
listen 80;
# HSTS settings
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Pagespeed is not supported by Nextcloud, so if your server is built
# with the `ngx_pagespeed` module, uncomment this line to disable it.
#pagespeed off;
# HTTP response headers borrowed from Nextcloud `.htaccess`
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-XSS-Protection "1; mode=block" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# Path to the root of your installation
root /var/www/html;
# Specify how to handle directories -- specifying `/index.php$request_uri`
# here as the fallback means that Nginx always exhibits the desired behaviour
# when a client requests a path that corresponds to a directory that exists
# on the server. In particular, if that directory contains an index.php file,
# that file is correctly served; if it doesn't, then the request is passed to
# the front-end controller. This consistent behaviour means that we don't need
# to specify custom rules for certain paths (e.g. images and other assets,
# `/updater`, `/ocm-provider`, `/ocs-provider`), and thus
# `try_files $uri $uri/ /index.php$request_uri`
# always provides the desired behaviour.
index index.php index.html /index.php$request_uri;
# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Make a regex exception for `/.well-known` so that clients can still
# access it despite the existence of the regex rule
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
# for `/.well-known`.
location ^~ /.well-known {
# The rules in this block are an adaptation of the rules
# in `.htaccess` that concern `/.well-known`.
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
# Let Nextcloud's API for `/.well-known` URIs handle all other
# requests by passing them to the front-end controller.
return 301 /index.php$request_uri;
}
# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
# then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`
# to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
# Required for legacy support
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
#fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|svg|gif)$ {
try_files $uri /index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
# Rule borrowed from `.htaccess`
location /remote {
return 301 /remote.php$request_uri;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
server {
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_ciphers TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256;
ssl_ecdh_curve secp384r1;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
# HSTS settings
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Pagespeed is not supported by Nextcloud, so if your server is built
# with the `ngx_pagespeed` module, uncomment this line to disable it.
#pagespeed off;
# HTTP response headers borrowed from Nextcloud `.htaccess`
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-XSS-Protection "1; mode=block" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# Path to the root of your installation
root /var/www/html;
# Specify how to handle directories -- specifying `/index.php$request_uri`
# here as the fallback means that Nginx always exhibits the desired behaviour
# when a client requests a path that corresponds to a directory that exists
# on the server. In particular, if that directory contains an index.php file,
# that file is correctly served; if it doesn't, then the request is passed to
# the front-end controller. This consistent behaviour means that we don't need
# to specify custom rules for certain paths (e.g. images and other assets,
# `/updater`, `/ocm-provider`, `/ocs-provider`), and thus
# `try_files $uri $uri/ /index.php$request_uri`
# always provides the desired behaviour.
index index.php index.html /index.php$request_uri;
# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Make a regex exception for `/.well-known` so that clients can still
# access it despite the existence of the regex rule
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
# for `/.well-known`.
location ^~ /.well-known {
# The rules in this block are an adaptation of the rules
# in `.htaccess` that concern `/.well-known`.
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
# Let Nextcloud's API for `/.well-known` URIs handle all other
# requests by passing them to the front-end controller.
return 301 /index.php$request_uri;
}
# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
# then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`
# to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
# Required for legacy support
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
#fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|svg|gif)$ {
try_files $uri /index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d; # Cache-Control policy borrowed from `.htaccess`
access_log off; # Optional: Don't log access to assets
}
# Rule borrowed from `.htaccess`
location /remote {
return 301 /remote.php$request_uri;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
}
Step 7: Copy/Create files at /var/lib/docker/volumes/nextcloud_sslcerts/_data
Create 3 files key.pem, cert.pem and dhparam.pem at /var/lib/docker/volumes/nextcloud_sslcerts/_data
- Copy /home/ankit/nextcloud/certs/dhparam.pem -> dhparam.pem
- Copy /home/ankit/nextcloud/certs/mycloud.example.com.key -> key.pem
- Copy /home/ankit/nextcloud/certs/myCA.pem -> cert.pem
5. Start Nextcloud
Please be patient as this task will consume some time. Take a break and enjoy a cup of coffee while waiting. You can access nextcloud at https://raspberrypi.local:8443
1
sudo docker-compose up -d
6. Compare with your config.php file add/remove as per your requirement
file path: /var/lib/docker/volumes/nextcloud_nextcloud/_data/config/config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
$CONFIG = array (
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'htaccess.RewriteBase' => '/',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'cache',
'password' => '',
'port' => 6379,
),
'instanceid' => 'sfsdfsfssfbbr',
'passwordsalt' => 'sdfsdfssdfsdfsdf/sdfsfsdfsdfsdfsfsdf',
'secret' => 'sdfsdfsdfsdfsdfsfsdfsdfsdf+sdfsdfsfsdfsdfsdfsdfsfd/u',
'trusted_domains' =>
array (
0 => '192.168.0.111',
1 => 'mycloud.example.com',
2 => '127.0.0.1',
),
'datadirectory' => '/extdata',
'dbtype' => 'pgsql',
'version' => '28.0.4.1',
'trusted_proxies' =>
array (
0 => '172.18.0.1',
1 => '172.17.0.9',
3 => '172.17.0.10',
4 => '172.17.0.11',
5 => '172.17.0.12',
6 => '172.17.0.13',
7 => '172.17.0.14',
8 => '172.28.0.1',
9 => '172.28.0.6',
),
'default_phone_region' => 'IN',
'auth.bruteforce.protection.enabled' => true,
'allow_local_remote_servers' => true,
'config_is_read_only' => false,
'overwrite.cli.url' => 'https://mycloud.example.com',
'dbname' => 'nextcloud',
'dbhost' => 'db',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_example@gmail.com',
'dbpassword' => 'sdfsfsdfsdfsdfsdfsdfsdfsdfsdfsdf',
'installed' => true,
'preview_max_x' => 1024,
'preview_max_y' => 1024,
'jpeg_quality' => 85,
'preview_max_memory' => 2048,
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\TXT',
1 => 'OC\\Preview\\Krita',
2 => 'OC\\Preview\\OpenDocument',
3 => 'OC\\Preview\\JPEG',
4 => 'OC\\Preview\\PNG',
5 => 'OC\\Preview\\GIF',
6 => 'OC\\Preview\\BMP',
7 => 'OC\\Preview\\MP3',
8 => 'OC\\Preview\\MarkDown',
9 => 'OC\\Preview\\MP4',
10 => 'OC\\Preview\\HEIC',
11 => 'OC\\Preview\\Image',
12 => 'OC\\Preview\\Movie',
),
'preview_imaginary_url' => 'http://192.168.0.111:9000',
'enable_previews' => true,
'preview_ffmpeg_path' => '/usr/bin/ffmpeg',
'preview_concurrency_all' => 8,
'maintenance' => false,
'maintenance_window_start' => 1,
'knowledgebaseenabled' => false,
'mail_from_address' => 'support',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_domain' => 'example.com',
'mail_smtpauth' => 1,
'mail_smtpname' => 'support@example.com',
'mail_smtppassword' => 'dfgdfgdfgdfgdfg',
'mail_smtphost' => 'smtp.zoho.in',
'mail_smtpport' => '465',
'twofactor_enforced' => 'true',
'twofactor_enforced_groups' =>
array (
0 => 'admin',
),
'twofactor_enforced_excluded_groups' =>
array (
),
'loglevel' => 2,
'theme' => '',
'defaultapp' => 'files,photos',
'app_install_overwrite' =>
array (
0 => 'facerecognition',
),
'data-fingerprint' => '3715582310f7720e5c45650636e297d',
'memories.db.triggers.fcu' => true,
'memories.exiftool' => '/var/www/html/custom_apps/memories/bin-ext/exiftool-aarch64-musl',
'memories.vod.path' => '/var/www/html/custom_apps/memories/bin-ext/go-vod-aarch64',
'memories.vod.ffmpeg' => '/usr/bin/ffmpeg',
'memories.vod.ffprobe' => '/usr/bin/ffprobe',
);
Adding Cloudflare Zero Trust Reverse Proxy
Coming soon
Install Nextcloud Memories App [Optional]:
You should try this app
Download the Memories App Visit the Nextcloud app store or GitHub repository to download the latest version of the Nextcloud Memories app. You can find it at Nextcloud Apps.
Extract the App Files Extract the downloaded .tar.gz or .zip file to the /mnt/toshiba/docker/volumes/nextcloud_nextcloud/_data/custom_apps directory on your server. You can use the following command for extraction:
1
tar -xzvf /path/to/downloaded/memories-app.tar.gz -C /mnt/toshiba/docker/volumes/nextcloud_nextcloud/_data/custom_apps
Enable the App Run the following command to enable the app using Docker:
1
docker exec -it -u www-data nextcloud_cron_1 /bin/sh -c "php occ app:enable memories"
Download the mobile app: https://memories.gallery/install/#mobile-apps
Troubleshooting:
If generating Diffie-Hellman parameters takes too much time, you can modify the script to use a shorter key size. Edit the script by changing the Diffie-Hellman parameters generation command as follows:
1
openssl dhparam -out dhparam.pem 512
Note: Update
NEXTCLOUD_EXTDATAin.envif your external storage path is different.
✅ Final Checklist
- Docker containers are running (
docker ps) - Nextcloud is accessible at
https://raspberrypi.local:8443 - SSL certificates are valid
- External storage is mounted and accessible
- Cloudflare Zero Trust (if used) is configured
