Config.php resets every reboot

The Basics

  • Nextcloud Server version: the latest or so (i set it up about a week ago)
  • Operating system and version: Debian 12 (Proxmox VM)
  • Web server and version: AIO Docker (bundled web server)
  • Reverse proxy and version: Nginx Proxy Manager 2.12.3
  • PHP version: as provided by AIO
  • Is this the first time you’ve seen this error? Yes
  • When did this problem seem to first start? Since initial setup
  • Installation method: Nextcloud AIO Docker
  • Are you using Cloudflare, mod_security, or similar? Dont think so

Summary of the issue you are facing:

I’m running Nextcloud AIO inside a Docker container on a Proxmox VM (Debian 12).
The container is accessed through my domain via Nginx Proxy Manager (running on a separate LXC container, IP 192.168.2.29). The proxy is configured correctly and works well for other services.

After deploying Nextcloud AIO, I noticed that all client connections were logged as coming from the proxy IP, and the admin panel started showing brute-force protection warnings for repeated logins from the same IP.

I realized I had forgotten to set the TRUSTED_PROXIES environment variable during the initial container creation.

To fix it, I manually added trusted_proxies => ['192.168.2.29'] to the config.php file. This solved the issue—until I restarted the container. After every restart, the config.php is regenerated and my manual changes are lost again.


Steps to replicate:

  1. Start AIO container without TRUSTED_PROXIES variable
  2. Manually add trusted proxy IP to config.php
  3. Restart container
  4. trusted_proxies entry is gone
  5. Admin interface shows repeated login attempts from proxy IP

Admin interface warning

  • Brute-force protection warnings appear in the admin panel
  • No related entries in nextcloud.log

Reverse Proxy Config (Nginx Proxy Manager)

nginx

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-Proto $scheme;

client_max_body_size 0;
client_body_buffer_size 512k;
proxy_read_timeout 86400s;

Docker startup command used (without TRUSTED_PROXIES)

bash

sudo docker run -d \
  --init \
  --sig-proxy=false \
  --name nextcloud-aio-mastercontainer \
  --restart always \
  --publish 8080:8080 \
  --env APACHE_PORT=11000 \
  --env APACHE_IP_BINDING=0.0.0.0 \
  --env APACHE_ADDITIONAL_NETWORK="" \
  --env SKIP_DOMAIN_VALIDATION=true \
  --env NEXTCLOUD_DATADIR="/mnt/ncdata" \
  --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
  --volume /var/run/docker.sock:/var/run/docker.sock:ro \
  ghcr.io/nextcloud-releases/all-in-one:latest

Question

Since I already created the container without setting TRUSTED_PROXIES, how can I now persistently add the reverse proxy IP?

  • Do I need to recreate the container from scratch?
  • Can I apply this setting via an environment variable afterward?
  • Is there a supported way to persist custom config.php entries in AIO?

Thanks a lot in advance!

Hi, can you follow What if the correct remote ip-address is not shown in the Nextcloud logs when login fails? · nextcloud/all-in-one · Discussion #2045 · GitHub?

Actually it was an easy fix hehe

I always removed the 172.18.0.0 network within the trusted proxys because i assumed it was some kind of placeholder. Turns out it is the internal network for communication between the docker containers. I guess Nextcloud AIO repaired itself with resetting the config.php

N I actually added my Proxy ip and didnt delete something else and its working. IPs are correctly tracked and no more brute force protection

thanks for the help