跳到正文
DEV Community· Vishvajeet Shukla·· 3 小時前AI 評分46

如何透過在 VPS 自行託管應用程式削減成本(2026)

How to Cut Hosting Costs by Self-Hosting Your Apps on a VPS (2026)

AI 導讀

將多個小型應用程式整合到一部 Linux VPS 上自行託管,並控制維護所需時間,才有機會節省成本。ShipOwn 是適用於 Windows、macOS 和 Linux 的桌面應用程式,可透過 SSH 部署及管理自有 Linux 伺服器上的應用程式,並處理部署、HTTPS 和回滾等工作。

正文

Managed platforms are priced per app, per seat, per build minute or per gigabyte of bandwidth. That's fair when you have one big app. It adds up fast when you're a freelancer or a small team running ten small ones: client sites, internal tools, side projects, staging copies.

A single Linux VPS can often host all of them. This guide explains how to work out whether self-hosting actually saves you money, how to consolidate apps safely, and where tools like ShipOwn reduce the time cost that usually eats the savings.

We won't quote prices here because they change constantly and depend on your region and usage. Use your own invoices for the maths below.

Step 1: Audit what you pay for today

Make a simple table from your last three invoices:

App Platform Monthly cost Traffic Needs always-on?
Client site A PaaS … low yes
Internal tool PaaS … very low no
API PaaS + DB add-on … medium yes

Look for:

  • Per-app minimums on apps that get almost no traffic.
  • Add-ons (databases, Redis, logging) priced separately.
  • Seat-based pricing for people who only deploy occasionally.
  • Bandwidth or function-invocation overages.

Step 2: Size one server for the whole group

Low-traffic Node apps under PM2 and static sites served by Nginx use little memory when idle. A static site uses no process at all, since Nginx serves files directly. That's why consolidation works.

Rough method:

  1. Check each app's memory in production (pm2 status or the platform's metrics).
  2. Add them up, plus headroom for builds (builds are the memory spike, not runtime).
  3. Add the database if you plan to host it on the same server (many people keep a managed DB instead).
  4. Pick a plan with comfortable margin. Resizing a VPS later is usually easy.

Tip: if builds are the bottleneck, build on your own machine and upload the output. ShipOwn's PC build mode does exactly this, so a small server only has to run the app.

Step 3: Count the hidden cost: your time

Self-hosting isn't free. You now own:

  • OS updates and security patches
  • Nginx configs and HTTPS renewals
  • Process restarts and crash recovery
  • Rollback when a deploy breaks
  • Monitoring and "is it down?" checks
  • Backups, especially for databases

If those take you several hours a month, compare that time to what you'd save. This is the line that decides whether self-hosting is cheaper, and it's where automation matters most.

Step 4: Consolidate safely

Give every app its own domain and port

client-a.example.com  → Nginx → 127.0.0.1:3001 (PM2)
tool.example.com      → Nginx → 127.0.0.1:3002 (PM2)
www.example.com       → Nginx → /var/www/site (static)
api.example.com       → Nginx → 127.0.0.1:8000 (Docker)

Isolate failures

  • One bad Nginx config can break every site. Test before every reload.
  • One app leaking memory can starve the others. Set PM2 max_memory_restart or container memory limits.
  • Keep releases separate so rolling back app A doesn't touch app B.

Watch the shared resources

Disk fills up from logs, old builds and Docker images. Check CPU, RAM, disk and load regularly.

Step 5: Migrate one app at a time

  1. Deploy the app to the VPS on a temporary subdomain.
  2. Test it, including env vars and webhooks.
  3. Lower the DNS TTL, then switch the real domain.
  4. Keep the old platform running for a few days.
  5. Cancel the old plan only when you're confident.

How ShipOwn lowers the time cost

ShipOwn is a desktop app for Windows, macOS and Linux that deploys and operates apps on Linux servers you own, over plain SSH, without installing a deployment agent on the server. It targets the maintenance tasks listed in Step 3:

  • Deploys Node apps under PM2 (Next.js, Nuxt, Remix, SvelteKit, NestJS, Fastify, Express), static sites on Nginx (Vite, Astro, plain HTML) and Docker/Compose apps, through one five-step flow: connect, pick source, review plan, watch build, operate.
  • Nginx and HTTPS: writes virtual hosts, tests before reload, restores a rejected config, requests Certbot certificates and shows expiry.
  • Rollback: each deploy has its own release directory, a failed deploy restores the previous release automatically, and you can switch back to a retained release later.
  • Monitoring: CPU, RAM, disk, load and PM2 processes read directly from the server, plus tray heartbeats that report an "unreachable" incident after two consecutive failures (while the app runs and your PC is awake).
  • Security basics: fail2ban can be installed and viewed from the app.
  • Debugging: an AI terminal using your own Anthropic, OpenAI or DeepSeek key proposes one command at a time for your approval.

It also shows which commit each app runs and how far behind its branch it is, which is handy when you have many small apps on one box.

What it doesn't do: auto-deploy on push, and it doesn't replace a backup plan for your databases.

When self-hosting is not cheaper

  • You have one app that fits a free or low tier already.
  • You rely heavily on platform features like preview deployments or a global edge network.
  • Nobody on the team is willing to own the server.

FAQ

Can I keep my database managed and self-host only the apps? Yes, and for many teams that's the best balance.

How many apps can one VPS run? It depends on memory and traffic. Measure, then size with headroom.

Is ShipOwn free? It starts with a free 30-day trial, no card required, then paid plans.

Conclusion

Self-hosting saves money when you consolidate several small apps and keep the maintenance time low. Measure your real costs, size one server sensibly, migrate one app at a time, and let ShipOwn handle the repetitive deploy, HTTPS and rollback work.


Written by Vishvajeet Shukla, full stack developer and creator of ShipOwn.

來源:DEV Community · dev.to