Run the Node.js application as a dedicated systemd service on a private loopback port, then let NGINX handle public HTTP, HTTPS, and reverse-proxy routing. This arrangement starts the app at boot, restarts it after failures, centralizes logs in the journal, keeps the Node listener off the public internet, and gives you one place to terminate TLS and forward client headers.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What the deployment looks like
The production path has three separate responsibilities:
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
- Node.js runs your application and listens on a local port such as
127.0.0.1:3000. - systemd starts that process during boot, owns its lifecycle, applies its restart policy, and records its output.
- NGINX is the public edge. It accepts requests on ports 80 and 443, terminates TLS, adds forwarding headers, and proxies traffic to Node.js.
A browser therefore never needs to connect directly to port 3000. Only NGINX needs access to the application listener. The exact service paths and package commands vary by Linux distribution, but the unit and proxy patterns are portable.
Prepare the server and application
Choose a stable application directory
Deploy the project somewhere that will not change between releases, such as /srv/myapp. Avoid running the production process from a developer home directory or a temporary checkout. Create a service account with no interactive shell:
#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.
sudo useradd --system --home /srv/myapp --shell /usr/sbin/nologin myapp
sudo install -d -o myapp -g myapp /srv/myapp
Copy the application into that directory and make the service account the owner. Keep deployment files, runtime files, and secrets separate where practical. The account only needs the permissions required to read the application and write the directories your app explicitly uses.
Install production dependencies
Use the Node.js version supported by the application and make sure the absolute executable path is known:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemscommand -v node
node --version
npm --version
For a project with a lockfile, install only production dependencies as the service account:
sudo -u myapp -- sh -c 'cd /srv/myapp && npm ci --omit=dev'
If your application uses a compiled step, run that step during deployment and verify that the resulting entry point exists. Do not assume that node is at /usr/bin/node; use the path returned by command -v node in the unit file.
Make the app listen privately
Configure the server to read its port from the environment and bind to loopback. For example, the application may use PORT=3000 and listen on 127.0.0.1. Binding to 0.0.0.0 exposes the process on every network interface and defeats the isolation provided by NGINX unless your firewall explicitly prevents access.
Create the systemd service
Write the unit file
Create /etc/systemd/system/myapp.service as root. This example assumes the entry point is /srv/myapp/server.js; change it to your real file or package-script command.
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
[Unit]
Description=My Node.js application
After=network.target
[Service]
Type=simple
User=myapp
Group=myapp
WorkingDirectory=/srv/myapp
Environment=NODE_ENV=production
Environment=PORT=3000
EnvironmentFile=-/etc/myapp/myapp.env
ExecStart=/usr/bin/node /srv/myapp/server.js
Restart=on-failure
RestartSec=5
KillSignal=SIGTERM
TimeoutStopSec=30
[Install]
WantedBy=multi-user.target
After=network.target orders startup after basic networking. User and Group prevent the application from running as root. WorkingDirectory makes relative paths predictable. ExecStart must contain an absolute Node executable and the actual application entry point. Restart=on-failure asks systemd to restart an unclean exit without repeatedly restarting a process that stopped successfully.
The optional environment file is useful for values that should not be embedded in the unit:
sudo install -d -m 0750 -o root -g myapp /etc/myapp
sudo sh -c 'cat > /etc/myapp/myapp.env' <<'EOF'
DATABASE_URL=postgres://user:[email protected]:5432/app
SESSION_SECRET=replace-with-a-long-random-value
EOF
sudo chmod 0640 /etc/myapp/myapp.env
Use your secret-management process instead of placing credentials in shell history or source control. The leading hyphen in EnvironmentFile=-... means the unit can still start if that file is absent; remove the hyphen when the file is mandatory so a missing configuration fails loudly.
Load, enable, and inspect the service
- Ask systemd to reread unit files:
sudo systemctl daemon-reload. - Enable startup at boot and start immediately:
sudo systemctl enable --now myapp.service. - Check the current state and recent failure reason:
sudo systemctl status myapp.service. - Read application output and restart history:
sudo journalctl -u myapp.service. - Follow new log entries while testing:
sudo journalctl -u myapp.service -f.
If the service fails immediately, inspect the absolute path in ExecStart, the working directory, ownership of the entry point, required environment variables, and the port reported in the journal. A successful systemctl enable only creates the boot relationship; it does not prove that the application itself can start.
Put NGINX in front of Node.js
Define the local upstream and proxy headers
Create an NGINX site configuration appropriate for your distribution. The upstream name keeps the backend address in one place:
upstream node_backend {
server 127.0.0.1:3000;
}
server {
listen 80;
listen [::]:80;
server_name app.example.com;
location / {
proxy_pass http://node_backend;
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;
}
}
Replace app.example.com with the hostname that resolves to the server. Host preserves the requested hostname for virtual-host routing. The other headers let the application determine the original client address and whether the client used HTTP or HTTPS. Configure the framework to trust the proxy only according to its documented proxy setting; otherwise an application may accept forwarded values from untrusted clients.
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)
Enable the site and test configuration
On distributions that use a sites-enabled directory, link the site into that directory; on others, include the file from the main NGINX configuration. Then test before every reload:
sudo nginx -t
sudo nginx -s reload
Use service nginx reload instead if that is the service command provided by your distribution. Do not reload after a failed syntax test. A reload applies a valid configuration to new workers while existing connections finish under the old workers.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Enable HTTPS and redirect HTTP
Configure the TLS server
You need a certificate and matching private key issued by the certificate authority or managed certificate service you selected. Store the files with permissions that allow NGINX to read the key but do not make it broadly readable. Add a TLS server block:
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name app.example.com;
ssl_certificate /etc/letsencrypt/live/app.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;
location / {
proxy_pass http://node_backend;
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;
}
}
The certificate paths above are an example layout; use the paths supplied by your certificate installation. A certificate without its private key, an unreadable key, or a hostname mismatch will prevent NGINX from starting or cause browser warnings.
Redirect port 80
Once the TLS block works, make the port-80 server redirect rather than proxying plaintext requests:
server {
listen 80;
listen [::]:80;
server_name app.example.com;
return 301 https://$host$request_uri;
}
Keep the port-80 listener available if your certificate-renewal method needs an HTTP challenge. Confirm that DNS points the hostname to this server and that the firewall permits inbound TCP ports 80 and 443.
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
Proxy WebSockets correctly
WebSocket upgrade headers are hop-by-hop headers; NGINX does not forward them automatically. Put the upgrade settings in the location that serves the WebSocket endpoint, such as /ws/:
location /ws/ {
proxy_pass http://node_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;
}
Use the same WebSocket location in the TLS server block. Keep ordinary HTTP routes in a separate location if they do not need upgrade behavior. If the socket connects locally but fails through NGINX, inspect the location path, the upstream port, the HTTP version, and both upgrade headers before changing application code.
Deploy updates without losing control of the process
- Place the new release in the application directory or a new release directory owned by the service account.
- Install the lockfile-defined production dependencies and run the required build step.
- Check configuration and file permissions before stopping the old process.
- Restart the service with
sudo systemctl restart myapp.service. - Immediately inspect
sudo systemctl status myapp.serviceandsudo journalctl -u myapp.service -n 100. - Test the backend locally and then through the public hostname.
For a configuration-only NGINX change, use nginx -t followed by a reload rather than a full stop and start. A restart of the Node service is appropriate when application code, dependencies, or environment values changed.
Implement graceful shutdown in Node.js
When systemd stops or restarts the service, Node.js receives a POSIX signal such as SIGTERM. Register a handler that stops accepting new connections, closes the server, and exits after cleanup. A minimal HTTP example is:
Free tools Windows power users keep installed
One-click scans. No signup required.
const http = require('node:http');
const app = require('./app');
const server = http.createServer(app);
const port = Number(process.env.PORT || 3000);
server.listen(port, '127.0.0.1');
function shutdown(signal) {
console.log(`${signal} received; closing server`);
server.close((error) => {
if (error) {
console.error(error);
process.exit(1);
}
process.exit(0);
});
}
process.on('SIGTERM', () => shutdown('SIGTERM'));
process.on('SIGINT', () => shutdown('SIGINT'));
Add cleanup for database pools, queues, and other resources in the callback used by your framework. Keep the timeout in the unit long enough for normal requests to finish, but do not allow shutdown to hang indefinitely.
An uncaught exception leaves the process in an undefined state. Node.js documentation recommends an external monitor in a separate process to detect failure and restart the application rather than trying to continue inside the damaged process. In this architecture, systemd supplies that external supervision through the unit’s restart policy; fix the underlying exception instead of treating automatic restarts as a substitute for error handling.
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.
Diagnose the common failure modes
| Symptom | Likely cause | What to check |
|---|---|---|
systemctl status shows a rapid restart loop |
Bad entry-point path, missing environment variable, permission error, or application crash | Read journalctl -u myapp.service; run the same absolute command as the service account; verify the working directory and secrets file. |
| NGINX returns 502 Bad Gateway | Node is stopped, listening on a different address or port, or blocked by a local permission/network rule | Check service status, then run curl http://127.0.0.1:3000/ on the server and compare the result with the proxy_pass target. |
| Requests reach Node but redirects or secure-cookie logic are wrong | The application is not receiving the original scheme | Confirm X-Forwarded-Proto $scheme and configure the framework’s trusted-proxy option appropriately. |
| WebSocket handshake fails | Upgrade headers are missing, the location does not match the socket path, or the upstream is wrong | Verify proxy_http_version 1.1, Upgrade, Connection, and the endpoint path in NGINX logs. |
| HTTPS will not load | Certificate path, key permissions, DNS, or firewall problem | Run nginx -t, verify both certificate files, confirm the hostname resolves to the server, and allow TCP 443. |
| Changes are not visible | The edited file was not included, or a daemon reload/restart was omitted | Use nginx -T to inspect the active configuration, systemctl daemon-reload after unit edits, and reload or restart the affected service. |
When isolating a problem, test from the inside out: first the Node listener with curl, then NGINX locally, then the public DNS name over HTTP or HTTPS. This separates application, proxy, and network errors instead of changing all three layers at once.
Run multiple Node.js instances
Use an NGINX upstream group
For more than one application process, give each instance a different local port and list them in the upstream:
Outdated 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 matchWindows 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 reinstallupstream node_backend {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
Keep the same proxy_pass http://node_backend; in the server block. NGINX Open Source uses round-robin distribution by default. Each instance needs its own process definition or an instance template, and every process must share access to required configuration and application assets.
Account for state and failure behavior
Multiple instances change the design questions. In-memory sessions and local-only uploads can send a user to a different process on the next request; use a shared session store or another state strategy when the application requires it. WebSocket clients also need a plan for reconnects and, where appropriate, shared pub/sub state. NGINX Open Source provides basic upstream distribution, while NGINX Plus adds advanced health checks, monitoring, session persistence, and dynamic upstream reconfiguration. Choose the simpler direct proxy for one instance; introduce an upstream group only when the application and operations process can support the extra failure and state considerations.
Production checklist
- The Node process runs under a dedicated non-root account.
- The application binds to a private loopback address when NGINX is the only public entry point.
- The unit specifies an absolute executable, working directory, environment, restart policy, and boot target.
systemctl daemon-reloadis run after unit changes, and the service is enabled withsystemctl enable --now.- NGINX forwards the host, client address, forwarding chain, and original scheme.
- HTTPS uses a valid certificate and matching private key, with HTTP redirected to HTTPS.
- WebSocket locations explicitly forward HTTP/1.1 upgrade headers.
nginx -tsucceeds before every reload.- Ports 80 and 443 are allowed through the firewall, while the Node port is not publicly exposed.
- Logs are checked in both the systemd journal and NGINX access/error logs.
- The application handles SIGTERM and closes resources cleanly.
With these pieces in place, systemd owns reliable process startup and recovery, while NGINX provides the controlled public boundary. The Node.js application can remain a private local service, and each layer can be tested independently when a deployment fails.
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.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.




