iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
Keep your Node.js application listening on 127.0.0.1:3000, and let NGINX listen publicly on port 80. NGINX then reverse-proxies each browser request to Node and returns the response, so visitors use http://example.com instead of http://example.com:3000.
What “point port 3000 to port 80” actually means
Ports are listener endpoints, not permanent aliases. Your Node process listens on one TCP port, while a web server can listen on another. To make a site available on the standard HTTP port, you need a process bound to port 80 that forwards requests to the Node listener on port 3000.
The usual production arrangement is:
- Node.js: listens only on
127.0.0.1:3000, keeping the application off the public network interface. - NGINX: listens on port 80, selects the correct virtual host, sends the request to Node, receives the response, and sends it back to the browser.
- Visitors: connect to the domain without a port suffix because browsers use port 80 for plain HTTP.
NGINX’s proxy_pass directive is the connection between the two ports. This is a reverse proxy, not a change to Node’s listening port.
Why NGINX reverse proxying is usually the right solution
It keeps application and public listeners separate
Node remains on a predictable local address while NGINX owns the public HTTP socket. A failure or restart of the application does not require changing the public listener configuration.
#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.
It supports host-based routing
NGINX can run multiple server blocks on port 80. It first considers the destination address and port, then uses the request’s Host header to select the matching server_name. This lets one server route different domains to different applications.
It preserves request context
When NGINX proxies a request, it can forward the original host, client address, forwarding chain, and scheme. Without those headers, an application may construct the wrong absolute URL, record NGINX’s address instead of the visitor’s, or misidentify whether the original request used HTTP.
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 →It leaves room for HTTPS and other edge controls
Port 80 is plain HTTP. NGINX can later listen on port 443 for TLS and either serve secure traffic directly or redirect port 80 requests to HTTPS. It also provides a place for virtual-host selection, header handling, buffering, and other proxy controls.
Prerequisites and checks before changing configuration
- Node.js is installed and your application can start successfully.
- The application has a clear entry point and a stable service or process manager.
- NGINX is installed and can bind to port 80.
- Your domain’s DNS record points to the server’s public address.
- No other service is already using port 80.
- Your host firewall or cloud security rules allow inbound TCP traffic on port 80.
Test Node locally first. From the server, request http://127.0.0.1:3000 with a browser or an HTTP client. If that request fails, NGINX cannot fix the application; resolve the Node process, bind address, or application error first.
Step 1: Make Node listen on port 3000
Node’s server.listen([port[, host...]]) API accepts both a port and a host. Bind the application to loopback so only local processes can reach it, then let NGINX provide the public entry point.
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
const http = require('node:http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Node is responding');
});
server.listen(3000, '127.0.0.1', () => {
console.log('Listening on http://127.0.0.1:3000');
});
Framework applications normally read the values from environment variables instead:
const port = process.env.PORT || 3000;
const host = process.env.HOST || '127.0.0.1';
app.listen(port, host, () => {
console.log(`Listening on http://${host}:${port}`);
});
After starting the application, verify that it is actually listening on the expected address. A process bound only to another interface, such as an IPv6-only loopback address, may not match an NGINX upstream written as 127.0.0.1. Keep the host and the proxy_pass address consistent.
Step 2: Add an NGINX server block for port 80
Create or edit the server block that should answer for your domain. The following configuration forwards every path to Node and passes the original request details.
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;
}
}
What each directive does
listen 80;makes this block receive HTTP traffic on port 80.server_namelists the hostnames that should select this block. Replace the examples with the names in your DNS and certificate plan.location /matches the site’s URL paths.proxy_pass http://127.0.0.1:3000;sends the matched request to Node. The upstream port is explicitly 3000.proxy_http_version 1.1;uses HTTP/1.1 for the upstream connection, which is useful for applications that expect modern connection behavior.proxy_set_header Host $host;forwards the hostname the visitor requested.proxy_set_header X-Real-IP $remote_addr;supplies the address NGINX received from the client.proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;appends the client address to the forwarding chain.proxy_set_header X-Forwarded-Proto $scheme;tells the application whether the incoming request to NGINX used HTTP or HTTPS.
NGINX changes some proxy headers, including Host and Connection, by default. Set the headers your application needs explicitly, and configure the application’s proxy-trust behavior deliberately rather than trusting arbitrary client-supplied forwarding headers.
Step 3: Put the server block in the active configuration
The file location differs by distribution. On systems that use the common sites-enabled layout, you might create a file such as /etc/nginx/sites-available/example.com and link it into /etc/nginx/sites-enabled/. Other distributions load files from an conf.d directory. The important point is that the file must be included by NGINX’s main configuration.
PC 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 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #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.
Remove or adjust an unwanted default server block if it is catching requests before your named site. Do not delete a file blindly: inspect the loaded configuration and keep a copy of the working version so you can roll back.
Step 4: Validate, reload, and test
- Check syntax: run the distribution’s NGINX configuration test. On typical installations this is
sudo nginx -t. Do not reload if the test reports an error. - Reload NGINX: use the service manager’s reload operation, commonly
sudo systemctl reload nginx. A reload applies the new configuration without unnecessarily terminating existing workers. - Test locally through NGINX: request
http://127.0.0.1/with the intendedHostheader if DNS is not ready. This confirms that port 80 reaches the expected server block. - Test the public hostname: open
http://example.comand confirm the response is generated by Node, not by a default NGINX page. - Inspect logs: check the NGINX error and access logs together with the Node process logs. The timestamps usually show whether the request reached NGINX, whether NGINX connected upstream, and what the application returned.
If your operating system does not use systemd, use its own service-control command. The exact command is distribution-dependent; the sequence remains test, reload, request, and inspect logs.
How hostname matching affects the result
NGINX does not choose a site solely from the port number. It first matches the address and port, then compares the request’s Host header with server_name. If no name matches, NGINX uses the default server for that port. A block marked default_server becomes the fallback.
“Wrong site” symptoms usually have one of these causes:
- The browser is requesting a hostname that is absent from
server_name. - DNS points to a different machine.
- An older or default server block is marked
default_serverand is handling unmatched requests. - You edited a file that NGINX does not include.
Test with the exact hostname and review the active configuration rather than assuming the file you edited is the file NGINX loaded.
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.
Common failures and precise fixes
502 Bad Gateway
A 502 generally means NGINX could not obtain a valid response from the upstream. Confirm that Node is running, listening on 127.0.0.1:3000, and that the proxy_pass address matches exactly. Check for a crashed process, a different port in the environment, or a bind address mismatch. Test the upstream directly from the server before changing NGINX.
Connection refused on port 80
Check that NGINX is running and that its configuration loaded successfully. Then check whether another process already owns port 80. If NGINX cannot bind the socket, resolve the port conflict or stop the competing service. Also verify that the network firewall permits inbound TCP 80.
The default NGINX page appears
This indicates that the request reached NGINX but not the intended server block. Verify the hostname in the browser, the server_name values, DNS, and the default-server selection. Make sure your file is included and that NGINX was reloaded after editing.
The application sees the wrong host or client address
Confirm the four proxy headers in the server block and verify that the application is configured to trust them only from your proxy. Because NGINX modifies some headers by default, omitting these directives can produce incorrect redirects, generated links, logs, rate limits, or audit records.
Absolute URLs use HTTP when the visitor used HTTPS
Forward X-Forwarded-Proto and configure the application’s trusted-proxy setting appropriately. The header is meaningful only when the application trusts the NGINX instance that sets it; otherwise a client could spoof scheme information.
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
Adding HTTPS after port 80 works
Port 80 carries HTTP, not TLS. For HTTPS, add a separate NGINX listener on port 443 with your certificate and key, then decide whether the port-80 block should redirect all requests to the HTTPS URL or continue serving HTTP. A redirect is common when the site should be secure-only.
Keep the application upstream on 127.0.0.1:3000 unless there is a specific reason to change it. TLS termination at NGINX means Node can continue receiving ordinary HTTP on the private loopback connection while NGINX handles encrypted public traffic.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Directly binding Node to port 80 instead
Node can listen directly on port 80 because its listener API accepts an explicit port value:
server.listen(80, '0.0.0.0', () => {
console.log('Listening on port 80');
});
Low-numbered ports commonly require a privileged process or an operating-system capability. Running the application with elevated privileges increases the consequences of an application compromise, so use the least-privilege deployment model your operating system supports.
| Axis | NGINX reverse proxy | Node directly on 80 |
|---|---|---|
| Listener ownership | NGINX on 80; Node on 3000 | Node on 80 |
| Multiple hostnames | NGINX server blocks and Host matching | The application must route hosts |
| Proxy controls | Header forwarding and buffering | Implemented elsewhere |
| Change required | NGINX configuration | Node listener and service deployment |
Direct binding can be simpler for a single process, but the application then owns the public HTTP port and must provide any virtual-host, TLS, header, and edge-proxy behavior you would otherwise obtain from NGINX.
Operational checklist
- Node reports that it is listening on
127.0.0.1:3000. - A direct request to the upstream succeeds from the server.
- NGINX has a
listen 80block for the intended hostname. proxy_passpoints to the same host and port Node uses.- Host and forwarding headers match the application’s proxy-trust configuration.
- The configuration test passes before every reload.
- Port 80 is free, NGINX is running, and the firewall allows HTTP.
- DNS resolves the public hostname to this server.
- Logs from both layers are checked when a request fails.
Port 3000 to port 80: the short answer
Do not make port 3000 itself become port 80. Keep Node on 127.0.0.1:3000, bind NGINX to port 80, and use proxy_pass http://127.0.0.1:3000;. Set the correct server_name, forward the request headers your application needs, test the NGINX configuration, reload it, and verify both NGINX and Node logs. Bind Node directly to port 80 only when you intentionally want the application to own the public listener and accept the resulting deployment responsibilities.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
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.

