Keep Node.js listening on 127.0.0.1:3000 and let NGINX own public port 80. NGINX accepts the browser request, forwards it with proxy_pass to the Node process, receives the response, and sends that response back to the visitor. This reverse-proxy arrangement exposes your site at a normal HTTP URL without moving the application itself to the public interface.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
The setup takes four parts: bind Node to port 3000, create an NGINX server block that listens on port 80, forward the original request headers your application needs, then test and reload both services. The exact service-management command varies by operating system, but the configuration pattern is the same.
As an Amazon Associate I earn from qualifying purchases.
What “point port 3000 to port 80” actually means
Port forwarding in this context is not a router rule. It is a web-server proxy relationship on the same machine:
- Node.js listens privately on
127.0.0.1:3000. - NGINX listens publicly on
80, the standard HTTP port. - A request for your hostname reaches NGINX first.
- NGINX sends that request to
http://127.0.0.1:3000, receives the Node response, and returns it to the browser.
Visitors therefore use http://example.com rather than http://example.com:3000. Port 3000 remains an internal application detail, while port 80 is the public listener.
#1 Best Overall
- DUAL-BAND WIFI 6 ROUTER: Wi-Fi 6(802.11ax) technology achieves faster speeds, greater capacity and reduced network congestion compared to the previous gen. All WiFi routers require a separate modem. Dual-Band WiFi routers do not support the 6 GHz band.
- AX1800: Enjoy smoother and more stable streaming, gaming, downloading with 1.8 Gbps total bandwidth (up to 1200 Mbps on 5 GHz and up to 574 Mbps on 2.4 GHz). Performance varies by conditions, distance to devices, and obstacles such as walls.
- CONNECT MORE DEVICES: Wi-Fi 6 technology communicates more data to more devices simultaneously using revolutionary OFDMA technology
- EXTENSIVE COVERAGE: Achieve the strong, reliable WiFi coverage with Archer AX1800 as it focuses signal strength to your devices far away using Beamforming technology, 4 high-gain antennas and an advanced front-end module (FEM) chipset
- OUR CYBERSECURITY COMMITMENT: TP-Link is a signatory of the U.S. Cybersecurity and Infrastructure Security Agency’s (CISA) Secure-by-Design pledge. This device is designed, built, and maintained, with advanced security as a core requirement.
Why the NGINX reverse-proxy design is usually preferable
Running NGINX in front of Node separates the public web entry point from the application process. NGINX can select a site by hostname, apply proxy settings, and preserve request information while Node concentrates on application responses. It also lets one NGINX instance serve several hostnames through separate server blocks.
Node can bind directly to port 80, but then the application owns the public HTTP port and must provide any hostname routing or proxy behavior itself. Changing the listener from 3000 to 80 is therefore a process-ownership change, not merely a different URL.
Prerequisites before changing ports
- A running Node.js application whose listener can be configured explicitly.
- NGINX installed on the same host as the application.
- A hostname that should be handled by the NGINX server block, such as
example.comand optionallywww.example.com. - Permission to edit NGINX configuration and reload the service.
- No other service already occupying port 80.
Start by deciding whether Node should be reachable only from the local machine. For the recommended arrangement, use 127.0.0.1. That makes the application available to NGINX on the host without making port 3000 the public interface.
Step 1: Make Node listen on 127.0.0.1:3000
Node’s server.listen([port[, host...]]) API accepts both a port and a host. Set the port to 3000 and the host to 127.0.0.1 in the code that starts your HTTP server.
server.listen(3000, '127.0.0.1', () => {
console.log('Node application listening on 127.0.0.1:3000');
});
If your framework exposes an app.listen method rather than a raw HTTP server, pass the same two values to that method. Restart the application after changing the listener. Before involving NGINX, verify that the process itself responds on the loopback address, for example with a request to http://127.0.0.1:3000.
Rank #2
- Dual-band Wi-Fi with 5 GHz speeds up to 867 Mbps and 2.4 GHz speeds up to 300 Mbps, delivering 1200 Mbps of total bandwidth¹. Dual-band routers do not support 6 GHz. Performance varies by conditions, distance to devices, and obstacles such as walls.
- Covers up to 1,000 sq. ft. with four external antennas for stable wireless connections and optimal coverage.
- Supports IGMP Proxy/Snooping, Bridge and Tag VLAN to optimize IPTV streaming
- Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home
- Advanced Security with WPA3 - The latest Wi-Fi security protocol, WPA3, brings new capabilities to improve cybersecurity in personal networks
Do not change the application to port 80 merely because the public URL uses port 80. The reverse proxy is what connects the two listeners.
Step 2: Create the NGINX server block
Add a server block to the NGINX configuration used by your distribution. This complete example receives HTTP traffic on port 80 and proxies every path to Node:
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_http_version 1.1;
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://127.0.0.1:3000;
}
}
Each directive has a specific job:
listen 80;makes this block eligible for ordinary HTTP requests on port 80.server_namelists the hostnames this block should handle.location /matches the site’s paths, including the root path.proxy_pass http://127.0.0.1:3000;is the connection between the public listener and the Node listener.proxy_http_version 1.1;tells NGINX which HTTP version to use for the upstream request.- The four
proxy_set_headerdirectives pass the requested hostname, client address, proxy chain, and original scheme to the application.
Use the hostname users actually request in server_name. If you serve both the bare domain and its www form, list both names as shown. Keep the semicolons and braces exactly balanced; one syntax error prevents NGINX from loading the configuration.
How NGINX chooses the right site
For an incoming request, NGINX first considers the address and port on which the request arrived. It then uses the HTTP Host header to select among matching server blocks. A block marked default_server becomes the fallback for that port when no more specific hostname matches.
This explains many “the wrong site appears” reports. The proxy may be functioning perfectly while the request is being handled by another server block. Check the requested hostname, the spelling of server_name, and which block is the default for port 80.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- NIGHTHAWK WIFI 6 ROUTER FOR YOUR WHOLE HOME: Delivers fast, reliable WiFi across every room of your apartment or small home for streaming, gaming, video calls, and smart home devices, all running at the same time without slowing each other down.
- WORKS WITH YOUR EXISTING INTERNET SERVICE: Pairs with your existing modem or gateway via ethernet. Compatible with most cable, fiber, DSL, and satellite providers. Some gateways and modem router combos may require bridge mode. No coax needed.
- SET UP AND MANAGE YOUR NETWORK WITH THE NIGHTHAWK APP: Download the free Nighthawk app on iOS or Android for guided setup. Manage WiFi, run speed tests, pause devices, and set up guest networks from anywhere. Active internet required.
- READY FOR THE DEVICES YOU ALREADY OWN: Your phones, laptops, and TVs work right out of the box. WiFi 6 delivers speeds up to 1.8 Gbps across 2.4 GHz and 5 GHz bands. Backward compatible with WiFi 5 and earlier.
- COVERAGE IN EVERY ROOM: Covers up to 1,500 sq. ft. for up to 20 connected devices. Walls, floors, and interference can reduce range. Larger or multi-story homes may benefit from a NETGEAR Orbi mesh WiFi system.
Step 3: Test and reload NGINX safely
- Save the server block in the configuration location used by your operating system. Some distributions load files directly from a configuration directory; others use an enabled-sites mechanism.
- Run the distribution’s NGINX configuration-test command before attempting a reload. A common installation uses
nginx -t; use the equivalent command supplied by your operating system if it differs. - Fix every reported syntax or file error. Do not reload a configuration that fails the test.
- Reload the NGINX service using your service manager. A typical systemd command is
sudo systemctl reload nginx; other systems use a different service command. - Request the public hostname over HTTP and watch the NGINX and Node logs if the response is not what you expect.
A reload applies the new server block without changing the Node listener. If NGINX cannot reload, return to the configuration-test output first rather than changing the application port.
Step 4: Verify the complete path
Test from the inside out so that each failure has a narrow cause:
- Request
http://127.0.0.1:3000on the server. A failure here means Node is stopped, listening on another address or port, or returning an application error. - Request the public hostname on port 80. If the loopback request works but the public request fails, inspect NGINX status, its error log, and whether another service owns port 80.
- Confirm that the response is from the intended application and that the requested hostname selects the intended server block.
- When behavior differs between direct and proxied requests, compare the headers received by the application. The proxy headers in the server block should explain the original host, client address, and scheme.
Preserving the original request context
A reverse proxy creates a second HTTP connection: the browser connects to NGINX, and NGINX connects to Node. Without explicit header settings, NGINX changes some proxy headers by default, including Host and Connection. Applications that build absolute URLs, record client addresses, enforce HTTPS, or generate redirects can therefore see different information than they would in a direct connection.
The example forwards the values most Node deployments need:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minute| Header | Value in the example | Purpose |
|---|---|---|
Host |
$host |
Preserves the hostname selected by the visitor. |
X-Real-IP |
$remote_addr |
Passes the address NGINX saw for the client connection. |
X-Forwarded-For |
$proxy_add_x_forwarded_for |
Maintains the client address and any existing proxy chain. |
X-Forwarded-Proto |
$scheme |
Reports whether the browser reached this NGINX listener over HTTP or HTTPS. |
Your application must be configured to trust forwarded headers only when they come from a proxy you control. Otherwise, client-supplied forwarding headers can be mistaken for verified connection details. If your framework generates incorrect absolute URLs or records NGINX’s address instead of the visitor’s, review both these directives and the framework’s proxy-trust setting.
Rank #4
- 𝐅𝐮𝐭𝐮𝐫𝐞-𝐏𝐫𝐨𝐨𝐟 𝐘𝐨𝐮𝐫 𝐇𝐨𝐦𝐞 𝐖𝐢𝐭𝐡 𝐖𝐢-𝐅𝐢 𝟕: Powered by Wi-Fi 7 technology, enjoy faster speeds with Multi-Link Operation, increased reliability with Multi-RUs, and more data capacity with 4K-QAM, delivering enhanced performance for all your devices.
- 𝐁𝐄𝟑𝟔𝟎𝟎 𝐃𝐮𝐚𝐥-𝐁𝐚𝐧𝐝 𝐖𝐢-𝐅𝐢 𝟕 𝐑𝐨𝐮𝐭𝐞𝐫: Delivers up to 2882 Mbps (5 GHz), and 688 Mbps (2.4 GHz) speeds for 4K/8K streaming, AR/VR gaming & more. Dual-band routers do not support 6 GHz. Performance varies by conditions, distance, and obstacles like walls.
- 𝐔𝐧𝐥𝐞𝐚𝐬𝐡 𝐌𝐮𝐥𝐭𝐢-𝐆𝐢𝐠 𝐒𝐩𝐞𝐞𝐝𝐬 𝐰𝐢𝐭𝐡 𝐃𝐮𝐚𝐥 𝟐.𝟓 𝐆𝐛𝐩𝐬 𝐏𝐨𝐫𝐭𝐬 𝐚𝐧𝐝 𝟑×𝟏𝐆𝐛𝐩𝐬 𝐋𝐀𝐍 𝐏𝐨𝐫𝐭𝐬: Maximize Gigabitplus internet with one 2.5G WAN/LAN port, one 2.5 Gbps LAN port, plus three additional 1 Gbps LAN ports. Break the 1G barrier for seamless, high-speed connectivity from the internet to multiple LAN devices for enhanced performance.
- 𝐍𝐞𝐱𝐭-𝐆𝐞𝐧 𝟐.𝟎 𝐆𝐇𝐳 𝐐𝐮𝐚𝐝-𝐂𝐨𝐫𝐞 𝐏𝐫𝐨𝐜𝐞𝐬𝐬𝐨𝐫: Experience power and precision with a state-of-the-art processor that effortlessly manages high throughput. Eliminate lag and enjoy fast connections with minimal latency, even during heavy data transmissions.
- 𝐂𝐨𝐯𝐞𝐫𝐚𝐠𝐞 𝐟𝐨𝐫 𝐄𝐯𝐞𝐫𝐲 𝐂𝐨𝐫𝐧𝐞𝐫 - Covers up to 2,000 sq. ft. for up to 60 devices at a time. 4 internal antennas and beamforming technology focus Wi-Fi signals toward hard-to-reach areas. Seamlessly connect phones, TVs, and gaming consoles.
Troubleshooting common failures
502 Bad Gateway
A 502 means NGINX could not obtain a valid response from the configured upstream. Check the three values that must agree:
- The Node process is running.
- Node is listening on
127.0.0.1:3000, not a different port or host. - The NGINX directive is exactly
proxy_pass http://127.0.0.1:3000;(or matches your deliberate alternative).
Request the loopback URL directly. If it fails, fix Node first. If it succeeds, read the NGINX error log and verify that the reloaded configuration is the file containing the server block.
The wrong site or a default page appears
Review the Host value sent by the browser, the spelling and aliases in server_name, and the server block selected as default_server. NGINX checks the listener address and port before hostname matching, so a block listening on another port cannot handle a request received on port 80.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Connection refused on port 80
Confirm that NGINX is running and that its configuration loaded successfully. Also check for another service already owning port 80. If a different process has that listener, NGINX cannot accept the request until the conflict is resolved or the services are assigned different ports.
Port 3000 works locally, but the domain fails
A successful loopback request proves only that Node is healthy on the local machine. A domain request additionally depends on NGINX listening on port 80, the request reaching that host, and the hostname matching the intended server block. Check those layers in that order, then inspect both services’ logs.
Best Value
- Dual band router upgrades to 1200 Mbps high speed internet (300mbps for 2.4GHz plus 900Mbps for 5GHz), reducing buffering and ideal for 4K stream
- Full Gigabit Ports - Gigabit Router with 4 Gigabit LAN ports, ideal for any internet plan and allow you to directly connect your wired devices
- Boosted Coverage - Four external antennas equipped with Beamforming technology extend and concentrate the Wi-Fi signals
- MU-MIMO technology - (5GHz band) allows high speeds for multiple devices simultaneously
- Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home
Redirects contain the wrong scheme or hostname
Check proxy_set_header Host $host and proxy_set_header X-Forwarded-Proto $scheme. The application may also need to trust those headers. If NGINX changes the host or the application does not trust the forwarded scheme, generated URLs can point to the internal address or use HTTP when the visitor used HTTPS.
Adding HTTPS later
Port 80 carries HTTP; it does not provide TLS encryption. HTTPS requires a separate NGINX listener on port 443 with the appropriate TLS configuration. You can then decide whether port 80 should continue serving HTTP or redirect visitors to HTTPS.
Crashes, 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 minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11A port-80 redirect block has this shape:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}
The HTTPS server block still proxies application requests to http://127.0.0.1:3000 unless you separately configure encryption between NGINX and Node. Configure and test the TLS listener before enabling a redirect; otherwise HTTP visitors can be sent to an unavailable endpoint.
Directly binding Node to port 80 instead
Node’s listener API accepts an explicit port, so an application can listen on port 80 rather than 3000:
server.listen(80, '0.0.0.0', () => {
console.log('Node application listening on port 80');
});
This is the simpler topology for one process: there is no NGINX hop, and Node owns the public listener. It also changes the responsibilities of the application and deployment:
- The application must provide any hostname routing that separate NGINX server blocks would have supplied.
- Proxy header handling and related controls must be implemented elsewhere.
- Only one process can own port 80 on the host.
- Binding a standard low port may require elevated privileges, depending on the operating system and service configuration. NGINX documentation commonly uses port 80 with superuser privileges and port 8000 when running without them.
Use direct binding only when those trade-offs are intentional. For a conventional production deployment, keeping Node on loopback port 3000 and placing NGINX on port 80 preserves a clean boundary between the public web listener and the application.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
NGINX versus direct Node binding
| Decision point | NGINX reverse proxy | Node directly on port 80 |
|---|---|---|
| Listener ownership | NGINX owns port 80; Node owns port 3000. | Node owns port 80. |
| Multiple hostnames | Separate NGINX server blocks and Host matching. |
The application must route hostnames itself. |
| Proxy controls | Header forwarding and other proxy behavior are configured in NGINX. | Those controls must be implemented elsewhere. |
| Application change | Keep the Node listener on 127.0.0.1:3000 and add the server block. |
Change the listener and adapt service privileges and deployment. |
| Failure isolation | Test Node and NGINX independently through their two listeners. | One process handles both the application and public listener. |
Final deployment checklist
- Node listens on
127.0.0.1:3000. - The NGINX block contains
listen 80;and the correctserver_namevalues. proxy_passpoints to the exact address and port where Node is listening.- Host and forwarded-address headers are present when the application needs original request context.
- The NGINX configuration test passes before reload.
- NGINX is running and no competing service owns port 80.
- A direct loopback request succeeds before you diagnose the public hostname.
- For HTTPS, port 443 is configured separately and any port-80 redirect is enabled only after the TLS endpoint works.
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.




