I installed a new instance of Nextcloud Docker on a Debian Machine. The Docker instance is listening on host port 8088 and it is working fine. I can connect to that instance on port 8088.
However I have on the host machine a Nginx as proxy where I want to proxy into the Nextcloud instance.
But if I now call the https://cloud1.floeser.net the request is redirected to https://www.cloud1.floeser.net and the connection is not established.
I have other subdomains running which are fine.
Why is the browser redirected to “www.” ?
The nginx virtual host:
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name cloud1.floeser.net;
root /var/www/html;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
index index.php index.html /index.php$request_uri;
location / {
proxy_set_header Host $http_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;
proxy_pass http://127.0.0.1:8088/;
access_log /var/log/nginx/cloud1.access.log;
error_log /var/log/nginx/cloud1.error.log;
}
}
The docker-compose looks like this:
version: '3'
services:
db:
image: mariadb:10.6
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
restart: always
volumes:
- db:/var/lib/mysql:Z
environment:
- MYSQL_ROOT_PASSWORD=r00tpw
- MARIADB_AUTO_UPGRADE=1
- MARIADB_DISABLE_UPGRADE_BACKUP=1
env_file:
- db.env
redis:
image: redis:alpine
restart: always
app:
image: nextcloud:apache
restart: always
ports:
- 8088:80
volumes:
- nextcloud:/var/www/html:z
- /opt/nextcloud-docker/www/config:/var/www/html/config:z
- /opt/nextcloud-docker/www/data:/var/www/html/data:z
environment:
- MYSQL_HOST=db
- REDIS_HOST=redis
- APACHE_DISABLE_REWRITE_IP=1
- TRUSTED_PROXIES=cloud1.floeser.net localhost 127.0.0.1
- NEXTCLOUD_TRUSTED_DOMAINS=cloud1.floeser.net 127.0.0.1 localhost
- OVERWRITEHOST=cloud1.floeser.net
- OVERWRITEPROTOCOL=http
env_file:
- db.env
depends_on:
- db
- redis
cron:
image: nextcloud:apache
restart: always
volumes:
- nextcloud:/var/www/html:z
- /opt/nextcloud-docker/www/config:/var/www/html/config:z
- /opt/nextcloud-docker/www/data:/var/www/html/data:z
entrypoint: /cron.sh
depends_on:
- db
- redis
volumes:
db:
nextcloud: