Here the config files:
NC config.php
<?php
$CONFIG = array (
'instanceid' => '********',
'passwordsalt' => '******',
'secret' => '******',
'trusted_domains' =>
array (
0 => 'cloud.mydomain.tld',
1 => 'office.mydomain.tld',
2 => 'LOCALIP',
3 => 'localhost',
),
'datadirectory' => '/var/ncdata',
'dbtype' => 'mysql',
'dbname' => 'nextcloud_db',
'dbhost' => 'localhost:3306',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => '*******',
'dbpassword' => '*******',
'version' => '15.0.2.0',
'logtimezone' => 'Europe/Berlin',
'appstore.experimental.enabled' => true,
'appstoreenabled' => true,
'appstoreurl' => 'https://api.nextcloud.com/v1',
'appcodechecker' => true,
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/nextcloud/apps',
'url' => '/apps',
'writable' => true,
),
),
'mail_smtpmode' => 'smtp',
'mail_smtpauth' => 1,
'mail_smtpport' => '587',
'mail_smtphost' => 'smtp.maildomain.tld',
'mail_smtpauthtype' => 'LOGIN',
'mail_from_address' => 'cloud.mydomain',
'mail_domain' => 'maildomain.tld',
'mail_smtpsecure' => 'tls',
'mail_smtpname' => 'cloud.mydomain@maildomain.tld',
'mail_smtppassword' => '***',
'preview_libreoffice_path' => '/usr/bin/libreoffice',
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\PNG',
1 => 'OC\\Preview\\JPEG',
2 => 'OC\\Preview\\GIF',
3 => 'OC\\Preview\\BMP',
4 => 'OC\\Preview\\XBitmap',
5 => 'OC\\Preview\\MP3',
6 => 'OC\\Preview\\TXT',
7 => 'OC\\Preview\\MarkDown',
8 => 'OC\\Preview\\TIFF',
9 => 'OCA\\CameraRawPreviews\\RawPreview',
10 => 'OCA\\CameraRawPreviews\\IndesignPreview',
11 => 'OC\\Preview\\Movie',
12 => 'OC\\Preview\\Photoshop',
),
'filelocking.enabled' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '/var/run/redis/redis.sock',
'port' => 0,
'timeout' => 0,
),
'maintenance' => false,
'updater.server.url' => 'https://updates.nextcloud.com/updater_server/',
'updater.release.channel' => 'stable',
'loglevel' => 2,
'theme' => '',
'installed' => true,
'overwrite.cli.url' => 'https://cloud.mydomain.tld',
'defaultapp' => 'apporder',
'updater.secret' => '*****',
);
App list
Enabled:
- accessibility: 1.1.0
- activity: 2.8.2
- admin_audit: 1.5.0
- announcementcenter: 3.4.0
- apporder: 0.6.0
- audioplayer: 2.5.1
- bookmarks: 0.15.1
- bruteforcesettings: 1.3.0
- calendar: 1.6.4
- camerarawpreviews: 0.6.3
- checksum: 0.4.2
- circles: 0.16.0
- cloud_federation_api: 0.1.0
- comments: 1.5.0
- contacts: 3.0.1
- dashboard: 6.0.0
- dav: 1.8.1
- deck: 0.5.2
- dicomviewer: 1.1.0
- dropit: 0.1.3
- event_update_notification: 0.3.2
- external: 3.2.0
- federatedfilesharing: 1.5.0
- federation: 1.5.0
- files: 1.10.0
- files_accesscontrol: 1.5.0
- files_automatedtagging: 1.5.0
- files_downloadactivity: 1.4.0
- files_external: 1.6.0
- files_markdown: 2.0.5
- files_pdfviewer: 1.4.0
- files_readmemd: 1.0.0
- files_retention: 1.4.0
- files_rightclick: 0.9.1
- files_sharing: 1.7.0
- files_texteditor: 2.7.0
- files_trashbin: 1.5.0
- files_versions: 1.8.0
- files_videoplayer: 1.4.0
- firstrunwizard: 2.4.0
- gallery: 18.2.0
- groupfolders: 2.0.2
- jsloader: 1.0.2
- logreader: 2.0.0
- lookup_server_connector: 1.3.0
- mail: 0.11.0
- metadata: 0.8.0
- nextcloud_announcements: 1.4.0
- notes: 2.5.1
- notifications: 2.3.0
- oauth2: 1.3.0
- ojsxc: 3.4.3
- onlyoffice: 2.1.2
- password_policy: 1.5.0
- polls: 0.9.5
- previewgenerator: 2.0.0
- provisioning_api: 1.5.0
- quota_warning: 1.4.0
- ransomware_protection: 1.3.0
- serverinfo: 1.5.0
- sharebymail: 1.5.0
- sharerenamer: 2.3.0
- socialsharing_email: 1.0.5
- spreed: 5.0.0
- support: 1.0.0
- systemtags: 1.5.0
- tasks: 0.9.8
- telephoneprovider: 1.0.2
- theming: 1.6.0
- twofactor_backupcodes: 1.4.1
- twofactor_totp: 2.1.0
- updatenotification: 1.5.0
- workflowengine: 1.5.0
Disabled: - cms_pico
- drawio
- encryption
- files_mindmap
- files_reader
- issuetemplate
- ransomware_detection
- survey_client
- user_ldap
- user_usage_report
web server config onlyoffice
include /etc/nginx/includes/onlyoffice-http.conf;
## Normal HTTP host
server {
listen 0.0.0.0:80;
listen [::]:80;
server_name office.mydomain.tld;
server_tokens off;
## Redirects all traffic to the HTTPS host
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
}
#HTTP host for internal services
server {
listen 127.0.0.1:80;
listen [::1]:80;
server_name localhost;
server_tokens off;
include /etc/nginx/includes/onlyoffice-documentserver-common.conf;
include /etc/nginx/includes/onlyoffice-documentserver-docservice.conf;
}
## HTTPS host
server {
listen 0.0.0.0:443 ssl http2;
listen [::]:443 ssl http2;
server_name office.mydomain.tld;
server_tokens off;
root /usr/share/nginx/html;
## Strong SSL Security
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl on;
#ssl_verify_client off;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# modern configuration. tweak to your needs.
ssl_protocols TLSv1.2; # TLSv1.3;
ssl_ciphers 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
ssl_ecdh_curve secp384r1;
resolver 9.9.9.9 valid=300s;
resolver_timeout 10s;
ssl_stapling on;
ssl_stapling_verify on;
ssl_dhparam /etc/ssl/dhparam_4096.pem;
ssl_trusted_certificate /etc/ssl/ca-certs.pem;
ssl_certificate /root/.acme.sh/mydomain.tld_ecc/fullchain.cer;
ssl_certificate_key /root/.acme.sh/mydomain.tld_ecc/mydomain.tld.key;
ssl_certificate /etc/letsencrypt/live/mydomain.tld/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.tld/privkey.pem; # managed by Certbot
add_header X-Content-Type-Options nosniff;
# add_header Strict-Transport-Security max-age=31536000;
# add_header X-Frame-Options SAMEORIGIN;
include /etc/nginx/includes/onlyoffice-documentserver-*.conf;
}
web server config Nextcloud
upstream php-handler {
server unix:/run/php-fpm/php-fpm.sock;
}
server {
listen 80;
listen [::]:80;
server_name mydomain.tld;
server_tokens off;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name cloud.mydomain.tld;
server_tokens off;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 80 default_server;
listen [::]:80;
server_name _;
server_tokens off;
# enforce https
return 301 http://cloud.mydomain.tld;
}
server {
listen 443;
listen [::]:443;
server_name mydomain.tld;
server_tokens off;
# forward to cloud.mydomain.tld
return 301 https://cloud.mydomain.tld$request_uri;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# modern configuration. tweak to your needs.
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
ssl_ecdh_curve secp384r1;
resolver 9.9.9.9;
ssl_stapling on;
ssl_stapling_verify on;
ssl_dhparam /etc/ssl/dhparam_4096.pem;
ssl_trusted_certificate /etc/ssl/ca-certs.pem;
ssl_certificate /root/.acme.sh/mydomain.tld_ecc/fullchain.cer;
ssl_certificate_key /root/.acme.sh/mydomain.tld_ecc/mydomain.tld.key;
ssl_certificate /etc/letsencrypt/live/mydomain.tld/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.tld/privkey.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
add_header Referrer-Policy "no-referrer";
add_header Feature-Policy "accelerometer 'none'; autoplay 'self'; geolocation 'none'; midi 'none'; notifications 'self'; push 'self'; sync-xhr 'self'; microphone 'self'; camera 'self'; magnetometer 'none'; gyroscope 'none'; speaker 'self'; vibrate 'self'; fullscreen 'self'; payment 'none'; usb 'none'";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name cloud.mydomain.tld;
server_tokens off;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
ssl_ecdh_curve secp384r1;
resolver 9.9.9.9;
ssl_stapling on;
ssl_stapling_verify on;
ssl_dhparam /etc/ssl/dhparam_4096.pem;
ssl_trusted_certificate /etc/ssl/ca-certs.pem;
ssl_certificate /root/.acme.sh/mydomain.tld_ecc/fullchain.cer;
ssl_certificate_key /root/.acme.sh/mydomain.tld_ecc/mydomain.tld.key;
ssl_certificate /etc/letsencrypt/live/mydomain.tld/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.tld/privkey.pem; # managed by Certbot
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
add_header Referrer-Policy "no-referrer";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Path to the root of your installation
root /var/www/nextcloud/;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
# ACME challenge
location ^~ /.well-known {
allow all;
alias /var/lib/letsencrypt/.well-known/;
default_type "text/plain";
try_files $uri =404;
}
location ^~ /.well-known/acme-challenge/ {
allow all;
alias /var/lib/letsencrypt/.well-known/acme-challenge/;
}
# set max upload size
client_max_body_size 15G;
# Buffers
fastcgi_buffers 64 4K;
# Rather disable gzip! This would allow some attacks and that's not worth the performance improvement
gzip off;
# 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;
location / {
rewrite ^ /index.php$request_uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_pass_header Authorization;
fastcgi_pass_header http_oauth_token;
fastcgi_pass_header oauth_token_secret;
fastcgi_request_buffering off;
fastcgi_read_timeout 150; # added to solve issue with connection loss to php-fpm while downloading
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~ \.(?:css|js|woff|svg|gif)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read into
# this topic first.
# add_header Strict-Transport-Security "max-age=15768000;
# includeSubDomains; preload;";
#
# 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 X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Optional: Don't log access to assets
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
location /sites/ {
#rewrite /sites/(.*) https://$server_name/apps/cms_pico/pico/$1 redirect;
rewrite /sites/(.*) /apps/cms_pico/pico/$1 break;
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;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_pass https://cloud.mydomain.tld/;
}
location ~* \.(?:flv|mp4|mov|m4a)$ {
mp4;
mp4_buffer_size 30M;
mp4_max_buffer_size 200M;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
#include fastcgi_params;
#include php_optimization.conf;
fastcgi_pass php-handler;
fastcgi_param HTTPS on;
}
}