Use Nginx as the single public entry point, attach it and every proxied service to the same Docker network, and point each server block at the Compose service name—not a container IP. Publish ports on Nginx, keep application ports internal, forward the original request headers, then validate and test from inside the proxy container.
Antihost offers VPS plans with one-click Docker, NVMe storage and a 14-day free trial.
This arrangement gives each hostname an explicit routing rule while Docker’s internal DNS keeps service discovery stable when containers are recreated.
As an Amazon Associate I earn from qualifying purchases.
What a server block does in a Docker deployment
An Nginx server block matches an incoming request by listening port and hostname. Its location rules then decide where the request goes. With Docker, the destination is normally a service name and internal port on a shared network.
Nginx receives the client request, sends a corresponding request to the configured upstream, receives the upstream response, and returns that response to the client. The public listener therefore belongs on Nginx, while the application can remain reachable only from the Docker network.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
The three names that are easy to confuse
- Public hostname: the name users enter, such as
example.com. - Compose service name: the Docker DNS name, such as
web. Use this inproxy_pass. - Container IP address: an implementation detail that can change when a container is recreated. Do not hard-code it in Nginx.
Choose the network layout before writing configuration
Nginx can resolve a backend only when both containers are attached to a common Docker network. A Compose project creates a project network automatically, and every service attached to that network can discover the others by service name through Docker’s internal DNS.
One Compose project
For a single stack, declare one network and attach both the proxy and the application to it. Compose creates the network when the project starts.
Recommended Free Tools
Several Compose projects
If Nginx and the applications are managed by different Compose projects, create one reusable external network and attach services from each project to it. The network name must be identical in both configurations. A service that exists only on its private project network will not be resolvable from Nginx.
Check the final membership rather than relying on file inspection: Docker’s network view is the authority after the containers are running.
Declaring an external network
Create the shared network once, then mark it as external in each Compose file:
docker network create edge
networks:
edge:
external: true
name: edge
Both the Nginx project and each application project must use that same network name and attach the relevant service to edge. Do not create two project-local networks with similar names and assume Docker will merge them; they remain separate networks until you explicitly connect the containers.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Define the Compose services
The following pattern publishes HTTP and HTTPS on Nginx, mounts a read-only configuration directory, and exposes the application’s port only inside Docker. The value web is the service name that Nginx will resolve.
services:
nginx:
image: nginx:stable
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d:ro
depends_on:
- web
networks:
- edge
web:
image: your-app-image
expose:
- "8080"
networks:
- edge
networks:
edge:
driver: bridge
Why expose is different from ports
expose documents and makes the container port available to other containers on the network; it does not publish that port on the host. Nginx can reach web:8080 without a host mapping.
ports creates a host-to-container listener. Put those mappings on Nginx for public traffic. Publishing the backend as well increases the number of reachable entry points and can bypass the hostname routing, headers, access controls, and TLS policy in Nginx.
Make sure the application listens on the container interface
A process listening only on loopback inside the application container can reject connections from Nginx even though both services share a network. Configure the application to listen on its container interface and confirm that its actual internal port is the same one used by proxy_pass.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesWrite one server block for each hostname
Create a file such as example.conf in the directory mounted at /etc/nginx/conf.d. This block accepts requests for two hostnames and proxies them to the Compose service named web on port 8080.
server {
listen 80;
server_name example.com www.example.com;
location / {
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;
proxy_pass http://web:8080;
}
}
How the directives work together
listen 80selects the HTTP listener inside the Nginx container. The Compose mapping makes that listener available on the host.server_namematches the incoming HTTPHostvalue. Include every hostname that should use this application.location /catches paths beginning at the site root. More specific locations can be added when an application needs separate routing.proxy_pass http://web:8080uses Docker DNS and the backend’s internal port. It does not use a host address or a fixed container IP.Hostpreserves the requested hostname for virtual-host-aware applications.X-Real-IPcarries the immediate client address, whileX-Forwarded-Forappends the client address to the forwarding chain.X-Forwarded-Prototells the application whether the client-facing request arrived over HTTP or HTTPS.
Routing several applications
Add a separate server block for each hostname and point each block at its own Compose service. For example, an administrative site and a game API can share the Nginx listener while remaining separate routing targets. Keep the hostnames explicit; a request that does not match the intended server_name may be handled by a default server instead.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
Start the stack and apply configuration safely
- Put the Compose file and the server-block file in the directories referenced by the volume mount.
- Start the services with
docker compose up -d. - Check the published listeners and container state with
docker compose ps. - Validate the complete Nginx configuration inside the running proxy container with
docker compose exec nginx nginx -t. Do this before applying every edit. - If the test reports success, reload without replacing the container with
docker compose exec nginx nginx -s reload. Restart the service instead when a container-level change requires it. - Watch proxy errors and startup messages with
docker compose logs nginx.
A successful syntax test proves that Nginx can parse its files; it does not prove that Docker DNS resolves the backend or that the application is accepting traffic. Perform the connectivity test below as a separate check.
Configuration files and reloads
Because the configuration directory is mounted read-only, edit the files on the host and then run the syntax test in the container. A typo, duplicate directive, or invalid include prevents a safe reload and leaves the previous worker configuration serving requests. Keep server-block files in version control so a hostname, upstream, or certificate change can be reviewed and reversed. If an automated project generates Nginx configuration from container state, treat generation and reload as separate operations and verify the resulting configuration before exposing a new service.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Test the route from inside the proxy container
Testing from the host can hide Docker-network problems. Enter the Nginx container with Compose and test the backend using the same service name and internal port that appear in proxy_pass.
- Open a shell with
docker compose exec nginx sh(use the shell available in the image). - Resolve the service name from that shell. A successful lookup of
webconfirms that Docker’s internal DNS can see the service. - Request the application’s internal endpoint on port
8080. Use a command-line HTTP client available in the image, or temporarily use a diagnostic container on the same network if the Nginx image has no client. - Interpret the result separately from the public request: a failure here is a network, port, or application-listener problem; a successful internal request followed by a failed public request points to Nginx matching, headers, or host publication.
From the host, request the public address only after the internal test succeeds. Confirm that DNS for the public hostname points to the machine publishing Nginx’s port, and send the intended Host header when testing a hostname that is not yet publicly delegated.
Diagnose the common failure messages
| Symptom | Likely cause | What to check and fix |
|---|---|---|
host not found in upstream |
The name in proxy_pass is wrong, the services do not share a network, or Nginx started before the intended network attachment was present. |
Use the exact Compose service name, inspect network membership, then recreate or restart the affected services after correcting the network declarations. |
connection refused |
The application is listening on another internal port or only on loopback inside its container. | Verify the application’s listening address and port, align expose and proxy_pass, and test the internal endpoint from the Nginx container. |
502 Bad Gateway |
Nginx reached the network destination but the application failed, reset the connection, or returned a response Nginx could not use. | Read both Nginx and application logs, test the service directly over the Docker network, and confirm the upstream protocol and port. |
| The request reaches the wrong site | The request’s Host value does not match server_name, or another/default server block is selected. |
Check the exact hostname sent by the client, correct the server-name list, and review all loaded configuration files for a competing default block. |
| WebSocket or streaming traffic breaks | The application needs connection-upgrade headers or behavior different from ordinary buffered HTTP responses. | Preserve the upgrade headers required by the application and review proxy buffering and timeout settings for that workload. |
Inspect network membership directly
Run docker network inspect <network-name> from the host and confirm that the Nginx and backend containers appear in the same network. For separate projects, verify that both Compose files reference the same external network rather than two similarly named project networks.
Separate DNS errors from application errors
A DNS error occurs before Nginx can open a connection and normally indicates naming or network attachment. A refusal means a destination was found but no process accepted the connection on that port. A 502 indicates that Nginx connected far enough to receive an invalid, failed, or reset upstream response. This distinction prevents changing server-block syntax when the real fault is in the application process.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Decide where TLS and isolation belong
There is no single layout for every deployment. Evaluate the design along five practical axes: where TLS terminates, whether backends are isolated on private networks, whether configuration is hand-maintained or generated, whether services span one or multiple Compose projects, and how reloads and certificate renewal are automated.
| Architecture choice | Operational characteristic | Best fit |
|---|---|---|
| TLS terminates at Nginx | Nginx owns the public HTTPS listener and forwards the original scheme with X-Forwarded-Proto. |
Deployments that want one edge policy and one public entry point. |
| Backends on the edge network | Nginx and the proxied services share a network so service-name DNS works. | Simple stacks where that shared network is an acceptable trust boundary. |
| Backends on additional private networks | A backend can join the edge network for Nginx access and retain private network attachments for internal dependencies. | Applications that must separate public-edge reachability from database or worker traffic. |
| Hand-written server blocks | Routes are explicit, visible in version control, and straightforward to audit. | Teams that prefer deliberate changes and predictable reloads. |
| Generated configuration | An automation project such as nginx-proxy derives and reloads Nginx configuration from Docker container state, while still requiring a shared Docker network. |
Environments with frequent container changes and an accepted automation layer. |
| One Compose project | Compose creates and manages the shared project network. | A single application stack owned and deployed together. |
| Multiple Compose projects | An external network must be created and reused by each project. | Separately managed applications behind one central proxy. |
Choose the simplest arrangement that meets the isolation and automation requirements. Regardless of the choice, the proxy still needs network-level reachability to every backend it serves.
TLS and certificate operations
If Nginx terminates TLS, publish the HTTPS listener there and ensure each HTTPS server block has the certificate configuration required by your deployment. The application should still receive X-Forwarded-Proto so it can generate secure URLs and enforce HTTPS-aware behavior. Certificate renewal must be paired with an Nginx reload; document that automation alongside the Compose and server-block files. A renewed certificate on disk does not change the workers already holding the old configuration until a successful reload.
Handle WebSockets and long-lived responses deliberately
Ordinary HTTP proxying may not be sufficient for WebSockets, server-sent events, downloads that remain open, or other streaming responses. Such applications commonly require connection-upgrade headers, longer timeouts, and buffering choices that differ from a short request/response API.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Start by reproducing the failure against the backend from inside the Nginx container. If the direct request works but the proxied connection closes, review the application’s documented upgrade requirements and Nginx’s header, buffering, and timeout directives for that location. Keep these changes scoped to the affected location rather than changing every site.
Maintenance checklist
- Use the Compose service name in every Docker-network
proxy_passtarget. - Attach Nginx and each target service to the same network.
- Publish only the Nginx ports that must be public; keep backend ports internal with
exposewhere possible. - Include the correct hostnames in
server_nameand preserve host and forwarding headers. - Run
nginx -tinside the proxy container before every reload. - Use
docker compose ps,docker compose logs nginx, anddocker network inspectas separate checks for process state, proxy errors, and network membership. - Test service-name resolution and the internal backend port from inside the Nginx container.
- For separate Compose projects, verify that the network is explicitly external and identically named in both projects.
- Keep TLS, certificate renewal, generated configuration, and reload automation documented alongside the deployment files.
Final verification path
A reliable setup passes four independent checks: Docker shows both services on a common network; the Nginx container resolves the Compose service name; the backend answers on its internal port; and Nginx’s syntax test succeeds before a reload. Only then should you diagnose public DNS, hostname matching, or application-specific behavior. This order keeps a server-block problem distinct from a Docker networking problem and makes failures much faster to localize.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Frequently Asked Questions
Do I need to publish the application port with Docker Compose?
No. Publish ports on Nginx for public traffic and keep the backend internal when possible. Nginx reaches an application through the shared Docker network using its service name and internal port. Use expose to document that internal port; add a host ports mapping only when another host-level client genuinely requires it.
Why does Nginx say “host not found in upstream” even though the service is running?
Check the exact Compose service name in proxy_pass, then verify that Nginx and the backend are attached to the same network with docker network inspect. Separate Compose projects need one identically named external network. Recreate or restart services after correcting a missing network attachment.
Can I use a container IP address instead of the service name?
Avoid it. Container IP addresses can change when containers are recreated. Docker’s internal DNS registers the Compose service name and lets Nginx continue resolving the backend after a replacement. Use a name such as web followed by the internal application port.
How do I proxy two applications on one Nginx container?
Create one server block per hostname, list every intended name in server_name, and point each location at its own service name and internal port. Verify the client’s Host header, because an unmatched hostname can fall through to a default server block.
What should I check when the backend works internally but the public URL returns 502?
Confirm that the public DNS points to the host publishing Nginx, that the request uses the expected hostname, and that the matching server block is loaded. Then inspect Nginx and application logs, verify the upstream protocol and port, and check that the forwarded headers are present.
How do WebSockets or streaming responses change the setup?
They may require connection-upgrade headers, longer timeouts, and different buffering behavior than ordinary HTTP. First test the backend directly from inside the Nginx container. If that succeeds, apply the application’s required upgrade, buffering, and timeout directives only to the affected location.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhat is the safest way to apply a server-block edit?
Edit the host-mounted file, run docker compose exec nginx nginx -t, and reload with docker compose exec nginx nginx -s reload only after the test succeeds. Use logs to confirm startup and proxy behavior. Restart the service when a container-level change, rather than a configuration edit, is required.
The Bottom Line
Use Nginx as the public edge, connect it and each backend to a shared Docker network, and proxy to stable Compose service names rather than container IPs. Keep backend ports private, preserve host and forwarding headers, validate with nginx -t, and test DNS plus the internal port from inside the proxy container before troubleshooting public traffic.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




