How to access website locally and globally

Hi all,

I have a Docker container running in production, accessible via the public domain ABC.COM. I want to also access the same website locally using the private IP 10.1.0.212.

  • The site works fine on ABC.COM.
  • I want 10.1.0.212 to serve the same content without affecting the public access.

Can someone guide me on the best way to configure Docker/NGINX/networking to achieve this?

Any suggestions or examples would be appreciated.

If you’re already using NGINX as a reverse proxy in front of your container, you can configure your server block to listen on both the public and private IP addresses.

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

    server_name abc.com 10.1.0.212;

    location / {
        proxy_pass http://your_container:your_port;
        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;
    }
}