Skip to main content
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog

Loading…

Servers Are Up

Your apps, automation and data on hardware we own. Build a private stack with predictable capacity and access through your dashboard, API or SSH.

SLA with service creditsOwned hardwareUS-based

Make room for your next idea

Explore the capacity, apps and access options that fit your workload. Check current availability and your total before you buy.

Sign up freeView Pricing

Products

  • Linux VPS
  • Windows VPS
  • Cloud & SaaS Services
  • Cloud Storage (Azure)
  • Virtual Datacenter
  • AI & Agent Hosting
  • Containers
  • Instant Apps
  • Software Platforms
  • Network builder
  • Game Servers
  • Free Game Servers
  • Pricing

Resources

  • Free Network Tools
  • 2026 Pricing Benchmark
  • Live SVG Badges
  • Latency & Speed Test
  • Guides & Tutorials
  • Documentation
  • API Reference
  • MCP Server
  • CLI & SDKs
  • OpenAPI & llms.txt
  • Use Cases
  • Free Migration
  • Uptime & Reliability
  • Datacenter
  • System Status
  • Network
  • Provider Comparisons Hub
  • Compare Providers

Company

  • About Us
  • Enterprise
  • Security Architecture
  • Trust Center
  • Blog
  • FAQ
  • Compliance
  • Startup Program
  • Open-Source Sponsorship
  • Press & Media Kit
  • Referral Program
  • Help Center
  • Contact Us
© Servers Are Up
TermsPrivacySLARefund PolicyDPAAcceptable Use
Service information
Docs
  • Documentation Hub
  • Technical Knowledge Library
    Runbooks & 187 Blueprints
  • Choose a Product
    VMs, Containers & Cloud
  • First Linux Server
    SSH, Firewall & Apps
  • Windows Server 2025
    BYOL & Remote Desktop
  • Remote Access
  • Troubleshooting
  • FAQ
  • All Product Guides
    29 Step-by-Step Guides
  • Cloud & SaaS Catalog
    112 Cloud & SaaS Offerings
  • Azure Cloud Storage
    Hot/Cool/Archive & WORM
  • Resource Manager & RBAC
    Groups, Tags & Locks
  • Multi-Model Cloud DB
    JSONB, SQL & pgvector
  • Cloud Identity & ZTNA
    OIDC, SCIM & PIM
  • Key Vault & KMS
    Secrets & Envelope Keys
  • Cloud SIEM, SOAR & DLP
    Posture & Threat Response
  • API Gateway & Cloud DNS
    Edge WAF & DNS Zones
  • Serverless, Workflows & IoT
    Functions, Queues & DAGs
  • SaaS, Governance & Vault
    Budgets & Off-Host GRS
  • Linux Systems & Kernel
    SSH, UFW, sysctl & OOM
  • Self-Hosted Apps & Stacks
    Caddy, Nextcloud & Auth
  • Build Web Apps with AI
  • Next.js and React
  • TypeScript and Node.js
  • npm and Tooling
  • Data and APIs
  • Deploy and Operate
  • Tutorials
  • Infrastructure
  • Automation & Regions
  • API Overview
  • API v1 Reference
    Endpoints & 23 Scopes
  • MCP Server
    129 AI Agent Tools
  • Swagger / OpenAPI 3.1
  • API Playground
  • Versioning & Sunset
  • API Token Security
    Authentication & Tokens
  • Instances API
    Compute Resources
  • Networking API
    Networks & Ports
  • Storage API Availability
    Volumes & Backups
  • Webhooks & Events
    Event Notifications
  • Rate Limits & Best Practices
    Throttling & Retries
  • sau CLI Reference
    34 Commands (v0.2)
  • Browser Web CLI
  • SDKs
  • Infrastructure as Code
    Terraform & Ansible
  • Code Examples
  • CLI & SDK Guides
  • Security Guides
  • Security at a Glance
  • Zero Trust Architecture
  • Live Trust Center
  • Compliance
Need help?

Loading documentation...

Documentation/tutorials

Deploy Next.js Application

Run a production Next.js app on your server as a systemd service and publish it through a port forward.

Intermediate
10 min
Updated 2026-10-27

Deploy Ready-to-Run Infrastructure in Seconds

Linux VMs from $6/mo · Pooled Virtual Datacenters from $12/mo · Use code WELCOME20 for 20% off your first order.

Browse ServersView Pricing

Run a production Next.js application on a Linux server with Node.js and a systemd service, and publish it on your environment's public address.

Prerequisites

  • A Servers Are Up Linux server running Ubuntu 24.04
  • Your Next.js project in a Git repository

Step 1: Install Node.js

Turn on public SSH on the server's page and copy the command from its How to connect card. Root cannot sign in, so start a root shell for the steps below:

ssh sauuser@SERVER_ADDRESS -p SSH_PORT
sudo -i

Install Node.js 24 LTS from NodeSource, and Git:

curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
apt install -y nodejs git

# Verify
node --version  # v24.x
npm --version

Step 2: Create a Deploy User

The app runs as its own user, not as root:

adduser --disabled-password --gecos "" deploy

Step 3: Clone and Build

sudo -u deploy git clone https://github.com/your-org/your-app.git /home/deploy/app
cd /home/deploy/app
sudo -u deploy npm ci
sudo -u deploy npm run build

For a private repository, give the server a deploy key in your Git host, or clone with an access token.

Step 4: Run It as a Service

systemd starts the app at boot and restarts it if it stops:

cat > /etc/systemd/system/nextjs.service <<'EOF'
[Unit]
Description=Next.js app
After=network.target

[Service]
User=deploy
WorkingDirectory=/home/deploy/app
Environment=NODE_ENV=production
Environment=PORT=3000
ExecStart=/usr/bin/npm start
Restart=always

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable --now nextjs

# The app takes a few seconds to start: wait up to a minute for port 3000 to answer
timeout 60 sh -c 'until curl -s -o /dev/null http://127.0.0.1:3000/; do sleep 1; done'
curl -sI http://127.0.0.1:3000/ | head -n 1

Read its log with journalctl -u nextjs -f.

Step 5: Publish the App

A Linux server has no public address of its own, and nothing reaches it until you publish a port. On Network > Public access, under Port forwards, click Add a forward and choose the server, the protocol, an External port from your environment's block (the form names the range; every port in it is 10000 or higher) and the Target port your service listens on. The forward's row then shows the address and port to Connect to, and Who can connect limits it to the addresses you name. A forward opens its own firewall rule, so you add none for it.

A site you run on the server itself is served from its own web server. On the server's Console tab, under Website, give the port your web server listens on (plain HTTP; 80 unless you changed it) and click Serve website. The site gets its own address with HTTPS at once and stays private until you click Publish website. To put it at your own domain, add the domain on Network > Public access under Add a domain and choose that server; the platform obtains and renews its certificate. An app installed from Servers > [your server] > Apps, or an Instant App, takes your domain under Your own domain the same way.

For this app, add a forward with protocol TCP and Target port 3000, then open http://ADDRESS:PORT.

Step 6: Set Up Deployments

A deploy script pulls, builds and restarts the service. The deploy user may restart this one service and nothing else:

cat > /etc/sudoers.d/nextjs-deploy <<'EOF'
deploy ALL=(root) NOPASSWD: /usr/bin/systemctl restart nextjs
EOF
chmod 440 /etc/sudoers.d/nextjs-deploy
visudo -cf /etc/sudoers.d/nextjs-deploy

cat > /home/deploy/deploy.sh <<'EOF'
#!/bin/bash
set -euo pipefail
cd /home/deploy/app
git pull --ff-only
npm ci
npm run build
sudo /usr/bin/systemctl restart nextjs
echo "Deployed at $(date)"
EOF
chown deploy:deploy /home/deploy/deploy.sh
chmod 755 /home/deploy/deploy.sh

Run sudo -u deploy /home/deploy/deploy.sh by hand, or from CI/CD.

Environment Variables

Keep secrets in .env.production (not committed to Git), readable only by the deploy user. Next.js reads it at build and at start, so rebuild after changing it:

cat > /home/deploy/app/.env.production <<'EOF'
NEXT_PUBLIC_SITE_URL=http://ADDRESS:PORT
DATABASE_HOST=10.0.101.3
EOF
chown deploy:deploy /home/deploy/app/.env.production
chmod 600 /home/deploy/app/.env.production

Next Steps

  • CI/CD Pipeline
  • Monitoring
  • Load Balancer

Related Articles

CI/CD Pipeline

Read more

Monitoring

Read more

Load Balancer

Read more

Frequently Asked Questions

What does the Deploy Next.js Application documentation guide cover?
Run a production Next.js app on your server as a systemd service and publish it through a port forward. It is rated intermediate difficulty (10 min) and applies to Servers Are Up infrastructure and workflows.
Can I manage or automate these steps through the Servers Are Up dashboard, REST API v1, or MCP server?
Yes. Every Servers Are Up server includes browser-based SSH, WebRDP, and VNC console access in the dashboard, plus programmatic control via the REST API v1 (/api/v1) and hosted Model Context Protocol server (/api/mcp/v1) using a scoped Personal Access Token.

Need hands-on help with Deploy Next.js Application?

Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.

Was this article helpful?

On this page

PrerequisitesStep 1: Install Node.jsStep 2: Create a Deploy UserStep 3: Clone and BuildStep 4: Run It as a ServiceStep 5: Publish the AppStep 6: Set Up DeploymentsEnvironment VariablesNext Steps
Need Live Commands?

Open Aria in Wide Engineering Mode for distro-specific commands, compose tweaks, and isolated environment troubleshooting.

Knowledge Library