Hi,
After losing several disks on a ZFS volume (which didn’t like my last house changing), I lost my nextcloud configuration. To date, I can no longer access my nextcloud container and take a “502 Bad Gateway” error.
I precise i have a nginx proxy with modSecurity in front of my docker host.
For now, i have disabled modSecurity in my nginx proxy configuration, and I’m using proxy_pass to redirect requests to the nginx container of my nextcloud stack.
http {
modsecurity off;
modsecurity_rules_file /etc/nginx/modsec/main.conf;
server {
listen 80;
server_name nextcloud.domain.tld;
return 301 https://$server_name:443$request_uri;
}
server {
listen 443 ssl;
server_name nextcloud.domain.tld;
ssl_certificate /pki/fullchain.pem;
ssl_certificate_key /pki/privkey.pem;
access_log /var/log/nginx/nextcloud_access.log;
error_log /var/log/nginx/nextcloud_error.log;
location / {
proxy_pass https://192.168.0.210:10100; #IP address of my docker host and port of the web container in my nextcloud stack
}
}
Now, can you point out my error in the docker-compose.yml file below:
version : '3'
services:
nextcloud-db:
image: mariadb:10.6
container_name: nextcloud-db
restart: always
networks:
- nextcloud
ports:
- 10103:3306
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
volumes:
- /data_tech/nextcloud/nextcloud_db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=**********
- MYSQL_PASSWORD=**********
- MYSQL_DATABASE=**********
- MYSQL_USER=**********
nextcloud-redis:
image: redis:7.0.11
container_name: nextcloud-redis
restart: always
networks:
- nextcloud
ports:
- 10101:6379
command: redis-server --requirepass **********
nextcloud-app:
image: nextcloud:fpm-alpine
container_name: nextcloud-app
restart: always
networks:
- nextcloud
ports:
- 10102:9000
environment:
- MYSQL_PASSWORD=**********
- MYSQL_DATABASE=**********
- MYSQL_USER=**********
- MYSQL_HOST=nextcloud-db
- MYSQL_PORT=10103
- REDIS_HOST=nextcloud-redis
- REDIS_HOST_PORT=10101
- REDIS_HOST_PASSWORD=**********
- DEFAULT_PHONE_REGION=FR
- TRUSTED_DOMAINS=nextcloud.domain.tld
links:
- nextcloud-db
- nextcloud-redis
volumes:
- /data_tech/nextcloud/nextcloud_web:/var/www/html
nextcloud-web:
image: nginx:latest
container_name: nextcloud-web
restart: always
networks:
- nextcloud
ports:
- 10100:443
- 10099:80
links:
- nextcloud-app
volumes:
- /pki:/pki:ro # contain my letsencrypt certificates
- /data_tech/nextcloud/nginx.conf:/etc/nginx/nginx.conf
- /data_tech/nextcloud/nextcloud_web:/var/www/html
networks:
nextcloud:
external: true
I map the container ports as next :
- nextcloud-db : 10103 (on the port 3306 of the mariadb container)
- nextcloud-app : 10102 (on the port 9000 of the nextcloud:fpm container)
- nextcloud-redis : 10101 (on the port 6379 of the redis container)
- nextcloud-web : 10100 (on the port 443 of the nginx container)
I use the nginx.conf file which is present here [NGINX configuration — Nextcloud latest Administration Manual latest documentation] and just adapt upstream, server_name and ssl_certificate* and mount it in the nginx container as /etc/nginx/nginx.conf
upstream php-handler {
server 127.0.0.1:10102;
}
....
....
All container are in the same network “nextcloud”, wich is plugged on the docker bridge.
I saw in other post than curling the php-handler upstream can help to diag :
root@SL210:/data_tech/script# curl -v http://127.0.0.1:10102
* Trying 127.0.0.1:10102...
* Connected to 127.0.0.1 (127.0.0.1) port 10102 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:10102
> User-Agent: curl/7.81.0
> Accept: */*
>
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server
I don’t know if the answer is normal ?
.
I really don’t understand and I’m calling for help from @Reiner_Nippes (which I have seen in many posts of this type)… ransom of success?
Afterwards, I accept any help
Best regards,