Docker compose redirects port 9085 to port 80

Docker compose redirects port 9085 to port 80, unless I specify an additional path after the address, for example index.php.

docker-compose.yaml

version: "3.8"
services:
  web-nginx:
    container_name: web-nginx
    build: ./docker/nginx
    command: nginx -g "daemon off;"
    links:
      - web-php
    ports:
      - "9085:80"
      - "4444:443"
    volumes:
      - ./logs/nginx:/var/log/nginx
      - ./src:/var/www/html
  web-php:
    container_name: web-php
    build: ./docker/php
    ports:
      - "9001:9000"
    volumes:
      - ./src:/var/www/html
    working_dir: /var/www/html
  web-mysql:
    image: mysql:8.0.32
    container_name: web-mysql
    env_file:
      - ./env/mysql.env
    ports:
      - "3307:3306"
    volumes:
      - ./database/mysql:/var/lib/mysql
    command: '--default-authentication-plugin=mysql_native_password'

default.conf (nginx):

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.php;
        # index.html index.htm index.nginx-debian.html;

        server_name mysite;
        location / {
        # pass PHP scripts to FastCGI server
        #
        }
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass web-php:9000;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
        }
        #location ~ /\.ht {
        #       deny all;
        location = /favicon.ico { log_not_found off; access_log off; }
        location = /robots.txt { log_not_found off; access_log off; allow all; }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;
        }
        client_max_body_size 1024M;

}

docker/nginx/Dockerfile:

FROM nginx:1.25.4

ADD default.conf /etc/nginx/conf.d/default.conf

docker/php/Dockerfile:

FROM php:8.2-fpm

RUN apt-get update
RUN docker-php-ext-install pdo pdo_mysql mysqli

After creating the images, everything starts up normally.
docker ps:

ttsv@docker:~/wp3$ docker compose ps
WARN[0000] /home/ttsv/wp3/docker-compose.yaml: `version` is obsolete
NAME        IMAGE           COMMAND                  SERVICE     CREATED         STATUS         PORTS
web-mysql   mysql:8.0.32    "docker-entrypoint.s…"   web-mysql   5 seconds ago   Up 4 seconds   33060/tcp, 0.0.0.0:3307->3306/tcp, :::3307->3306/tcp
web-nginx   wp3-web-nginx   "/docker-entrypoint.…"   web-nginx   5 seconds ago   Up 4 seconds   0.0.0.0:9085->80/tcp, :::9085->80/tcp, 0.0.0.0:4444->443/tcp, :::4444->443/tcp
web-php     wp3-web-php     "docker-php-entrypoi…"   web-php     5 seconds ago   Up 4 seconds   0.0.0.0:9001->9000/tcp, :::9001->9000/tcp
ttsv@docker:~/wp3$

However, when I try to access the container at http://172.16.1.180:9085/, it redirects me to http://172.16.1.180/, where I have another Docker web running on port 80. If I stop this container, it still tries to redirect to it. However, when I add a specific path, for example http://172.16.1.180:9085/index.php, then it doesn’t redirect and stays at the current address and port. Does anyone have an idea why this behavior is happening?

OS:

ttsv@docker:~/wp3$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

Docker version:

ttsv@docker:~/wp3$ docker version
Client: Docker Engine - Community
 Version:           26.0.0
 API version:       1.45
 Go version:        go1.21.8
 Git commit:        2ae903e
 Built:             Wed Mar 20 15:18:01 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.0.0
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       8b79278
  Built:            Wed Mar 20 15:18:01 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

I solved the issue by adding the following lines to nginx:

server_name 172.16.1.180;
        location / {
                try_files $uri $uri/ =404;
        }
        location /wp-admin {
                try_files $uri $uri/ /wp-admin/index.php?$args;
        }

I added them because apparently WordPress is making some internal redirects; I have no idea why. Here’s how I caught them:

ttsv@docker:~/wp3$ curl -v http://172.16.1.180:9085/wp-admin/
*   Trying 172.16.1.180:9085...
* Connected to 172.16.1.180 (172.16.1.180) port 9085 (#0)
> GET /wp-admin/ HTTP/1.1
> Host: 172.16.1.180:9085
> User-Agent: curl/7.88.1
> Accept: */*
>
< HTTP/1.1 302 Found
< Server: nginx/1.25.4
< Date: Fri, 12 Apr 2024 12:54:32 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/8.2.18
< Expires: Wed, 11 Jan 1984 05:00:00 GMT
< Cache-Control: no-cache, must-revalidate, max-age=0
< X-Redirect-By: WordPress
< Location: http://172.16.1.180:9085/wp-login.php?redirect_to=http%3A%2F%2F172.16.1.180%3A9085%2Fwp-admin%2F&reauth=1
<
* Connection #0 to host 172.16.1.180 left intact