SET 6 NEXT.JS READY

myapp_mxbhkimtest0427nextjs

Cafe24 Dev Language VPS starter environment

Runtime
Node.js 24 LTS
Framework
Next.js + React
Database
MariaDB 11.4
Process
PM2 + systemd

Start Building (Quickstart)

  1. SSH: ssh root@172.233.88.90
  2. Upload code via SFTP / FileZilla / Cyberduck: host=172.233.88.90, user=root, target=/opt/myapp_mxbhkimtest0427nextjs/
  3. Ownership: chown -R appuser:appuser /opt/myapp_mxbhkimtest0427nextjs
  4. Install & Build: sudo -iu appusercd /opt/myapp_mxbhkimtest0427nextjspnpm install --prodpnpm build (REQUIRED — produces .next/ needed by next start)
  5. Restart: exitsudo -u appuser pm2 restart myapp_mxbhkimtest0427nextjs

Operate (root)

Service statussystemctl status pm2-appuser
App logssudo -u appuser pm2 logs myapp_mxbhkimtest0427nextjs
Restart appsudo -u appuser pm2 restart myapp_mxbhkimtest0427nextjs
DB envsudo cat /etc/myapp_mxbhkimtest0427nextjs/env

Reference (paths & configs)

RuntimeNode.js 24 LTS (Next.js 15 needs Node 18.18+).
Build toolpnpm install --prod + pnpm build (Next.js compiler -> .next/). npm/yarn work too.
Entry pointPM2 invokes node_modules/next/dist/bin/next start --hostname 127.0.0.1 --port 3000 directly (see ecosystem.config.js). package.json scripts.start is for manual pnpm start only.
Build output/opt/myapp_mxbhkimtest0427nextjs/.next/ (must exist before pm2 restart; produced by pnpm build)
PM2 config/opt/myapp_mxbhkimtest0427nextjs/ecosystem.config.js — fork mode, name=myapp_mxbhkimtest0427nextjs, script invokes npm start via Next.js. Reads /etc/myapp_mxbhkimtest0427nextjs/env at start.
systemd unit/etc/systemd/system/pm2-appuser.service — auto-generated by pm2 startup; runs as appuser. PM2 then resurrects ecosystem.config.js.
DB env file/etc/myapp_mxbhkimtest0427nextjs/env (mode 0640, root:appuser) — loaded by ecosystem.config.js, exposed to Next.js via process.env (server components & route handlers).
App port3000 (Next.js listen port). Nginx reverse-proxies :80 / :443 → :3000.
Logssudo -u appuser pm2 logs myapp_mxbhkimtest0427nextjs (rotated under ~appuser/.pm2/logs/). systemd journal: journalctl -u pm2-appuser.
Profile / NODE_ENVadd NODE_ENV=production to /etc/myapp_mxbhkimtest0427nextjs/env; ecosystem.config.js auto-loads it. Public env vars must be prefixed NEXT_PUBLIC_.
Redeployupload new source → chown -R appuser:appuser /opt/myapp_mxbhkimtest0427nextjssudo -iu appusercd /opt/myapp_mxbhkimtest0427nextjspnpm install --prodpnpm buildpm2 restart myapp_mxbhkimtest0427nextjs. Next.js fork-mode requires full restart (not reload) because the server boots once at process start.