Hello,
sorry to get to post this here, as I’v already configured working Nextcloud instances, and there is a lot of similar posts over there but I couldn’t solve it…
I want to use Nextcloud on a Hosted VM with Debian 10.
I use docker-compose to deploy nextcloud 20, along with mariadb, redis, collabora.
Everything (and other services too) are fronted by a nginx reverse proxy.
My nginx config doesn’t show errors, my docker-compose builds and runs withouts errors, and auto-install setting admin username in .env file works (see logs during install).
Then I access my login page, and it stays on it, the url shows the redirection requests but I’m just stuck on login page.
Nothing happens WHETER i use GOOD or WRONG credentials.
I don’t see nothing in docker logs that could lead me to the problem.
Here are revelant files:
docker-compose.yml
version: '3.7'
services:
nextcloud:
image: nextcloud:20
depends_on:
- nextcloud_db
- nextcloud_redis
extra_hosts:
- nextcloud.my.domain:$MY_SERVER_IPV4
- collabora.my.domain:$MY_SERVER_IPV4
env_file:
- .env
ports:
- "127.0.0.1:7724:80"
stdin_open: true
tty: true
volumes:
- ./nc_data/data:/var/www/html/data
- ./nc_data/skeleton:/var/www/html/core/skeleton
- ./nc_data/config:/var/www/html/config
- ./nc_data/apps:/var/www/html/custom_apps
networks:
default:
back:
nextcloud_db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
env_file:
- .env
volumes:
- ./nc_data/mysql:/var/lib/mysql
networks:
back:
nextcloud_redis:
image: redis
networks:
- back
ports:
- 6379:6379
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
command: redis-server /usr/local/etc/redis/redis.conf
coturn:
image: instrumentisto/coturn
container_name: nextcloud-coturn
restart: unless-stopped
ports:
- "3476:3478/tcp"
- "3476:3478/udp"
networks:
- back
command:
- -n
- --log-file=stdout
- --min-port=49160
- --max-port=49200
- --realm=nextcloud.my.domain
- --use-auth-secret
- --static-auth-secret=placehereasecretforcoturn
- --cert=/home/admin/nginx-proxy-ssl/nginx_data/letsencrypt/live/nextcloud.my.domain/fullchain.pem
- --pkey=/home/admin/nginx-proxy-ssl/nginx_data/letsencrypt/live/nextcloud.my.domain/privkey.pem
collabora:
image: collabora/code
container_name: nextcloud-collabora
restart: unless-stopped
extra_hosts:
- nextcloud.my.domain:$MY_SERVER_IPV4
- collabora.my.domain:$MY_SERVER_IPV4
networks:
- back
ports:
- 127.0.0.1:9982:9980
environment:
- domain=nextcloud.my.domain
- dictionaries=fr,en
cap_add:
- MKNOD
tty: true
networks:
back:
default:
nginx.conf
upstream nextcloud{
server 127.0.0.1:7724;
}
server {
if ($host = nextcloud.my.domain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name nextcloud.my.domain;
location /.well-known {
alias /var/www/nextcloud.my.domain/.well-known;
}
location / {
rewrite ^/(.*)$ https://$host/$1 permanent;
}
}
server {
listen 443 ssl;
server_name nextcloud.my.domain;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Upload limit and security
client_max_body_size 10000m;
server_tokens off;
# SSL parameters
ssl on;
ssl_certificate /etc/letsencrypt/live/nextcloud.my.domain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/nextcloud.my.domain/privkey.pem; # managed by Certbot
ssl_session_timeout 30m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES12$
# ssl_prefer_server_ciphers on;
# log
access_log /var/log/nginx/nextcloud.access.log;
error_log /var/log/nginx/nextcloud.error.log;
# Redirect requests to nextcloud backend server
location / {
proxy_redirect off;
proxy_pass http://nextcloud/;
}
rewrite ^/.well-known/webfinger /public.php?service=webfinger last;
location /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
location /.well-known/acme-challenge {
alias /var/www/nextcloud.talkie.social/.well-known/acme-challenge;
}
# common gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
config.php
<?php
$CONFIG = array (
'passwordsalt' => 'xxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxx',
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'nextcloud.my.domain',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'mysql',
'version' => '20.0.4.0',
'overwrite.cli.url' => 'https://nextcloud.my.domain',
'dbname' => 'next',
'dbhost' => 'nextcloud_db',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'ncuser',
'dbpassword' => 'xxxxxxxxxxx',
'installed' => true,
'instanceid' => '0x0Xxxxxxx',
);
console log at docker-compose deploy
admin@vps-3baf7b9f:/opt/talkie.social/nextcloud$ docker-compose logs nextcloud |head -n 15
Attaching to nextcloud_nextcloud_1
nextcloud_1 | Configuring Redis as session handler
nextcloud_1 | Initializing nextcloud 20.0.4.0 ...
nextcloud_1 | Initializing finished
nextcloud_1 | New nextcloud instance
nextcloud_1 | Installing with MySQL database
nextcloud_1 | starting nextcloud installation
nextcloud_1 | Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused
nextcloud_1 | ->
nextcloud_1 | retrying install...
nextcloud_1 | Nextcloud was successfully installed
nextcloud_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.6. Set the 'ServerName' directive globally to suppress this message
nextcloud_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.6. Set the 'ServerName' directive globally to suppress this message
nextcloud_1 | [Tue Dec 29 23:00:07.008177 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.13 configured -- resuming normal operations
nextcloud_1 | [Tue Dec 29 23:00:07.008275 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
Hope someone will be able to help me to solve that so config could be useful to others…
thanks !