Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk9 min

How to Point Port 3000 to Port 80 for a Node.js Site

Keep Node.js on 127.0.0.1:3000 and use an NGINX reverse proxy on port 80. This guide covers the server block, proxy headers, validation, HTTPS, direct binding, and fixes for 502 and hostname errors.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the Node.js process listening on 127.0.0.1:3000 and let NGINX listen publicly on port 80. NGINX acts as a reverse proxy: it accepts the browser request, forwards it to http://127.0.0.1:3000, then sends Node.js’s response back to the browser. The connection between the two ports is the NGINX proxy_pass directive.

The recommended layout

A production Node.js site normally has two listeners with different jobs:

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Node.js: listens on 127.0.0.1:3000. It serves the application but is not directly exposed to the network.
  • NGINX: listens on port 80, the conventional port for public HTTP traffic. It receives requests for your domain and proxies them to Node.js.

The request path is:

Browser → example.com:80 → NGINX → 127.0.0.1:3000 → Node.js → NGINX → Browser

Visitors therefore use http://example.com, not http://example.com:3000. Port 3000 remains an internal application port, while port 80 is the public entry point.

Why use NGINX instead of moving Node.js to port 80?

Putting NGINX in front of Node.js separates the public web server from the application process. NGINX can select a site by hostname, preserve request information in headers, and provide proxy behavior without requiring the Node.js application to own the public HTTP port.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

NGINX first considers the address and port on which a request arrived, then uses the request’s Host header to select the matching server block. This lets one NGINX instance serve multiple domains with separate configurations. A default_server can handle requests that do not match another configured hostname.

Direct binding is possible, but it gives the application ownership of port 80 and leaves hostname routing and proxy controls to code or another service. For a single-process experiment that may be acceptable; for a site that may grow to multiple hostnames or services, the reverse-proxy arrangement is usually easier to operate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prerequisites and decisions

Choose the address Node.js binds to

Use 127.0.0.1 when NGINX and Node.js run on the same machine. That address accepts connections from the local host, so NGINX can reach the application while the application is not listening on the machine’s public network interfaces.

Node’s server.listen([port[, host...]]) API accepts both a port and a host. A minimal HTTP server can therefore listen on the required address explicitly:

const http = require('http');

const server = http.createServer((request, response) => {
  response.writeHead(200, { 'Content-Type': 'text/plain' });
  response.end('Node.js is reachable through NGINX.');
});

server.listen(3000, '127.0.0.1');

If your framework already starts the server, set its host and port using that framework’s configuration. The important result is that the process is reachable at 127.0.0.1:3000.

Choose the public hostname

Replace example.com and www.example.com in the configuration with the names that should reach the application. The names must resolve to the machine running NGINX. If a request arrives with a different Host value, NGINX may select another server block or the port’s default server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand what port 80 means

Port 80 carries HTTP, not HTTPS. If the site must use encrypted connections, configure a separate TLS listener on port 443 and decide whether requests received on port 80 should be redirected to HTTPS. A port-80 proxy alone does not encrypt traffic.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Step-by-step: proxy port 80 to Node.js on port 3000

1. Start Node.js on the internal listener

Start the application with its configured host and port, then verify that the process is actually listening on 127.0.0.1:3000. Test the application locally before involving NGINX. If the application is not running, NGINX cannot forward a request to it.

Do not change the Node listener to port 80 merely because that is the public URL. The public and internal ports are intentionally different in this design.

2. Create an NGINX server block

Add a server block to the active NGINX configuration for the site:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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;
    }
}

The exact directory and activation procedure differs between operating-system packages. Place the block where your NGINX installation reads virtual-host configuration, make sure it is included by the main configuration, and avoid creating a second block with the same hostname unless you understand which one will win.

3. Check the hostname match

The server_name line controls which hostnames use this block. Include every intended name, such as the bare domain and its www form, separated by spaces. NGINX compares the request address and port first, then the Host header. If no name matches, the block marked default_server for port 80 handles the request.

A wrong-site symptom is therefore often a name-selection problem rather than a Node.js problem. Check the browser’s hostname, the value sent in the Host header, and the server block selected as the default.

4. Validate the configuration before reloading

Run the configuration-test command supplied by your NGINX installation. A commonly installed command is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
sudo nginx -t

Do not reload a configuration that fails validation. Fix syntax errors, missing semicolons, invalid include paths, or duplicate and conflicting declarations first. The precise command and privilege requirements depend on the operating system and how NGINX was installed.

5. Reload NGINX

After a successful test, reload the NGINX service using the service manager provided by your operating system. A typical systemd-based installation uses:

sudo systemctl reload nginx

A reload applies the new server block while allowing existing workers to finish their current work. If your platform uses a different service manager, use its equivalent reload operation. If NGINX is not running, start it according to that platform’s service procedure instead.

6. Test the public hostname

Open the configured hostname without appending :3000. The request should arrive at NGINX on port 80 and return the response produced by Node.js. If the local application works but the public request fails, inspect the NGINX error output and the Node.js application log together; the failure is usually at the listener, proxy target, or hostname-selection boundary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What each directive does

Directive Purpose in this setup
listen 80; Makes this server block receive HTTP traffic on port 80.
server_name example.com www.example.com; Associates the block with the listed hostnames after NGINX examines the request’s address, port, and Host header.
location / Matches the site’s URL paths and applies the proxy settings to them.
proxy_pass http://127.0.0.1:3000; Forwards the matched request to the Node.js listener. This is the directive that connects public port 80 to internal port 3000.
proxy_http_version 1.1; Uses HTTP/1.1 for the proxied connection to Node.js.
proxy_set_header Host $host; Passes the requested hostname to the application instead of allowing the proxy’s default host handling to obscure it.
proxy_set_header X-Real-IP $remote_addr; Passes the address of the client connection in a dedicated header.
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; Maintains the forwarded-client address chain when requests pass through proxies.
proxy_set_header X-Forwarded-Proto $scheme; Tells the application whether the client-facing request used the scheme seen by NGINX, such as HTTP.

NGINX changes some proxy headers, including Host and Connection, by default. Explicit header settings are useful when the application builds absolute URLs, records client addresses, applies host-based logic, or needs to know the original request scheme.

Only trust forwarded-address and forwarded-scheme headers according to your deployment. The application should know which proxy is allowed to set them; otherwise an untrusted client could submit misleading values directly.

How to diagnose common failures

502 Bad Gateway

A 502 generally means NGINX could not obtain a valid response from its upstream. Confirm all of the following:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
  • The Node.js process is running.
  • It is listening on 127.0.0.1:3000, not a different port or host.
  • The proxy_pass value is exactly http://127.0.0.1:3000 or otherwise matches the actual listener.
  • Local security controls are not preventing NGINX from connecting to the local port.

If Node.js was restarted with a different port, update either the application configuration or proxy_pass; both sides must agree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connection refused on port 80

This error occurs before the request reaches the Node.js proxy target. Check that NGINX is running, that the configuration was successfully loaded, and that no other service owns port 80. If another process already listens there, stop or reconfigure the conflicting service, or choose a different public listener.

The wrong site appears

Review the requested hostname and the NGINX server_name values. Confirm that the request is arriving on the address and port used by the intended block. Then inspect which block is marked default_server. A missing hostname or a typo can send an otherwise healthy request to the fallback site.

Localhost works, but the domain does not

Test the layers separately. First, reach Node.js locally on port 3000. Next, check NGINX on port 80 using the intended hostname. If the first test succeeds and the second fails, focus on NGINX syntax, service state, the server block, and the proxy target. If NGINX responds with the wrong content, focus on hostname matching rather than application code.

Absolute URLs contain the wrong host or scheme

Applications that generate redirects, canonical links, cookies, or API URLs may rely on the original host and protocol. Verify that the Host and X-Forwarded-Proto headers are present as configured and that the application is set to trust them only from its NGINX proxy. A proxy changes request context unless that context is deliberately forwarded and interpreted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The client IP is always the proxy address

Use the X-Real-IP and X-Forwarded-For settings shown above, then configure the application or framework to trust NGINX as its proxy. Without that application-side trust configuration, the framework may ignore forwarded headers; trusting every sender can allow clients to forge their apparent address.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Port 80 and HTTPS

The configuration above provides HTTP on port 80. For HTTPS, add a TLS-enabled listener on port 443 with the certificate and key settings required by your NGINX installation. Decide whether port 80 should continue serving HTTP or issue a redirect to the HTTPS hostname. In either case, the Node.js process can remain on 127.0.0.1:3000; only the public NGINX listeners change.

When HTTPS terminates at NGINX, the application may still receive a connection from NGINX over plain HTTP. That is why X-Forwarded-Proto matters: it allows application code to distinguish the original secure request from the internal proxy connection.

Directly binding Node.js to port 80

Node’s listener API accepts an explicit port, so an application can be configured to listen directly on port 80:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
server.listen(80, '0.0.0.0');

The exact host is a deployment choice; binding to all interfaces exposes the process wherever the machine is reachable. Ports below 1024 commonly require elevated privileges or an equivalent operating-system capability, and NGINX documentation distinguishes port 80 as its standard privileged listener while using port 8000 when running without superuser privileges.

Direct binding removes one service from the request path, but it also changes responsibility:

  • Node.js owns the public HTTP port and must remain available for every request.
  • Hostname routing must be implemented by the application or another layer.
  • Proxy header handling, buffering, and related web-server controls are no longer supplied by NGINX.
  • Adding another site or service on the same public port becomes an application-level problem.

Use direct binding only when those trade-offs fit the deployment. Changing the port number alone does not provide NGINX’s virtual-host selection or proxy behavior.

Reverse proxy versus direct Node.js binding

Decision point NGINX reverse proxy Node.js directly on port 80
Listener ownership NGINX owns port 80; Node.js listens on port 3000. Node.js owns port 80.
Multiple hostnames Handled with NGINX server blocks and Host matching. Must be routed by the application or another service.
Proxy controls NGINX supplies request forwarding and header controls. Those controls must be implemented elsewhere.
Change required Add and activate an NGINX server block, then reload NGINX. Change the Node.js listener and its service deployment.
Process exposure Node.js can remain on the loopback address. The application owns the public listener and its exposure policy.

Deployment checklist

  • Node.js listens on 127.0.0.1:3000.
  • NGINX has a server block with listen 80;.
  • server_name contains each hostname users will request.
  • location / contains proxy_pass http://127.0.0.1:3000;.
  • Host and forwarded-client headers are set when the application needs the original request context.
  • The NGINX configuration test completes successfully.
  • NGINX has been reloaded after the configuration test.
  • The public hostname is tested without appending :3000.
  • NGINX and Node.js logs are checked together when a request fails.
  • HTTPS requirements are handled separately on port 443, with an explicit decision about redirecting port 80.

Bottom line

To point port 3000 to port 80, do not make the browser connect to both ports. Keep Node.js on 127.0.0.1:3000, configure NGINX to listen on port 80, and use proxy_pass http://127.0.0.1:3000; inside the matching server block. Validate and reload NGINX, then troubleshoot the Node listener, hostname match, and proxy headers as separate layers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.