Works with the AI Agents you already use
Self-Host Next.js on a VPS with Docker
by Saizul Amin
This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice.
$8
Self-Host Next.js on a VPS with Docker
Example session with this skill installed
Run the Self-Host Next.js on a VPS with Docker skill on my project and give me a prioritised list of what to fix, with exact changes.
- Read your context and instructions
- Compiled the self-host next js
Here is what the Self-Host Next.js on a VPS with Docker skill produced.
Demo: real, unedited output of the skill's bundled script on a sample input from its test suite.
Output
self-host check: 2 high, 1 medium, 3 low, 1 info
HIGH DEP040 -Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/nextjs-react-skills/tests/fixtures/nextjs-deploy-selfhost/bad/nginx/site.conf
no `proxy_set_header Host $host` (Server Actions fail the Origin/Host check)
fix: proxy_set_header Host $host;
HIGH DEP045 -Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/nextjs-react-skills/tests/fixtures/nextjs-deploy-selfhost/bad/nginx/site.conf
proxy_cache ignores Cache-Control: private, per-user pages can be cached and served to others
fix: respect upstream Cache-Control; cache only /_next/static and /_next/image
MEDIUM DEP041 -Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/nextjs-react-skills/tests/fixtures/nextjs-deploy-selfhost/bad/nginx/site.conf
X-Forwarded-Proto not forwarded (wrong scheme in redirects/auth callbacks)
fix: proxy_set_header X-Forwarded-Proto $scheme;
LOW DEP042 -Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/nextjs-react-skills/tests/fixtures/nextjs-deploy-selfhost/bad/nginx/site.conf
X-Forwarded-For not forwarded (client IP lost for rate limits/logs)
fix: proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
LOW DEP043 -Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/nextjs-react-skills/tests/fixtures/nextjs-deploy-selfhost/bad/nginx/site.conf
nginx buffers responses: streaming / Suspense fallbacks arrive all at once
fix: proxy_buffering off; in the app location (or send X-Accel-Buffering: no from next.config headers)
LOW DEP046 -Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/nextjs-react-skills/tests/fixtures/nextjs-deploy-selfhost/bad/nginx/site.conf
proxy_http_version 1.0 disables keepalive and chunked streaming
fix: proxy_http_version 1.1;
INFO DEP044 -Users-SaizulAmin-Saizul-Old-PC-Saizul-com/bc16f08c-2133-4c9b-92e4-fd071b48ec64/scratchpad/src/nextjs-react-skills/tests/fixtures/nextjs-deploy-selfhost/bad/nginx/site.conf
no dedicated /_next/static location
fix: location /_next/static/ { proxy_pass ...; expires 1y; add_header Cache-Control "public, immutable"; }
What you do next
- Fix the highest-severity items first.
- Ask your agent to apply the fixes it suggests, then run the skill again to confirm.
- Keep the skill installed and re-run it whenever the project changes.
Connects securely to your tools. The creator never sees your data.
About this skill
Self-host a Next.js app on a VPS or in containers - output standalone builds, multi-stage Dockerfile (Node.js 20.9+, non-root, HOSTNAME=0.0.0.0, node server.js, .next/static and public copied), .dockerignore, nginx reverse proxy (Host and X-Forwarded headers, streaming without buffering, /_next/static caching, safe proxy_cache), systemd or PM2 without Docker, static export limits, image optimization with sharp, Cache-Control behaviour, and multi-instance needs (shared cacheHandler, deploymentId, NEXT_SERVER_ACTIONS_ENCRYPTION_KEY, graceful shutdown). Includes a checker for next.config, Dockerfile, .dockerignore and nginx configs.
Who it's for
Use when the user deploys Next.js without Vercel, writes a Dockerfile or nginx config for Next.js, sees missing CSS/JS (404 on /_next/static) after a Docker deploy, "Failed to find Server Action" errors, streaming that does not stream, huge images, or scales to more than one instance.
What's inside
- Tested, offline Python script(s): selfhost_check.py (deterministic results, standard library only unless noted)
- Reference guides: docker-nginx.md, caching-and-scaling.md
- Step-by-step agent instructions in SKILL.md covering: When to use; When not to use; Workflow; Key facts
Why it's worth it
Generic prompts guess. This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice. See the real demo below.
Works with every major AI agent
Built on the open SKILL.md standard: Claude Code, Codex CLI, Cursor, VS Code Copilot, Gemini CLI, Windsurf and 20+ other agents.
Requirements
- Python 3.8+ for the bundled scripts
- No API keys, no account, runs locally
Open source: saizul/nextjs-react-skills on GitHub (MIT licence, by Saizul Amin).
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
- Software
Python 3.8+