Deployment Guide Ncmaz Headless WordPress on aaPanel
Project Overview Ncmaz is a modern, high-performance blog/magazine built as a headless WordPress frontend using:
Next.js 15
Faust.js (Headless WordPress toolkit by WP Engine)
Tailwind CSS
TypeScript
The frontend fetches content via GraphQL (WPGraphQL) from your WordPress backend, enabling full SSR, ISR, previews, and optimal performance without losing Next.js advantages like Image Optimization and Middleware.
This guide explains how to deploy the frontend project (folder: ncmaz-faust) to a VPS running aaPanel using Node.js + PM2 + Nginx reverse proxy. This setup keeps all dynamic Next.js features intact (unlike static export).
Prerequisites
aaPanel installed on your VPS (latest version recommended).
Node.js β₯18 (preferably 20 or 22 for Next.js 15 compatibility).
Your WordPress site ready with:
WPGraphQL plugin
FaustWP plugin (or ncmaz-faust-core plugin included in the theme package)
Permalink set to "Post name"
Domain pointed to your VPS IP.
Faust Secret Key from WordPress β Settings β Faust (required for previews and authentication).
Step 1: Prepare aaPanel Environment
Log in to aaPanel.
Go to App Store β Install Node.js Version Manager (if not installed).
Install a compatible Node.js version (e.g., 20.x or 22.x).
Install PM2 Manager (aaPanel includes it for process management).
Step 2: Upload the Project
In aaPanel β Files β Create a new folder: /www/wwwroot/ncmaz-faust
Upload your entire ncmaz-faust project folder contents here (via File Manager, FTP, or SFTP). Ensure key files are present: package.json, next.config.js, faust.config.ts, app/, public/, Tailwind config, etc.
Step 3: Install Dependencies and Build
Open aaPanel Terminal (or SSH into the server).
Navigate to the project:Bash
Install dependencies:Bash
Build for production:Bash
Step 4: Set Environment Variables
Faust.js requires these variables for connecting to WordPress:
Create or edit .env.production in the project root (or add them directly in aaPanel Node Project settings later):
text
NEXT_PUBLIC_WORDPRESS_URL: Full URL to your WordPress site (must be accessible from the VPS).
FAUST_SECRET_KEY: Found in WordPress β Settings β Faust (critical for previews and revalidation).
Note: Do not commit these to Git in production.
Step 5: Create Node Project in aaPanel
Go to aaPanel β Node β Node Projects β Add Node Project.
Fill in:
Project Name: ncmaz-faust (or any name)
Path: /www/wwwroot/ncmaz-faust
Port: Choose an internal port (e.g., 3000 or 3001)
Startup File: Leave default (aaPanel detects Next.js)
Run Mode: PM2 (essential for background running and auto-restart)
Run Command: npm run start (or faust start / next start)
In Environment Variables tab: Add the two vars from Step 4.
Submit β aaPanel will run npm install (if needed), build, and start the app via PM2.
Step 6: Configure Nginx Reverse Proxy
Go to Website β Add Site β Create site with your domain (e.g., example.com).
In the site's Config tab, edit the Nginx configuration to proxy to your Node port:
nginx
Enable SSL (Let's Encrypt) directly in the SSL tab.
Step 7: Start and Test
In Node Projects β Start/Restart your project.
Visit your domain β The site should load with full SSR/ISR from your WordPress backend.
Check PM2 logs in aaPanel for any errors (GraphQL connection, env vars, etc.).
Test features: Previews, Image Optimization (next/image), ISR revalidation.
Optimization Tips for Next.js + Faust.js
ISR Revalidation: Faust handles webhook-based revalidation from WordPress automatically (via secret key).
Performance: Tailwind CSS 4 purges unused styles perfectly in production build.
Monitoring: Use PM2 dashboard in aaPanel to monitor CPU/memory and auto-restarts.
Updates: To update code, upload new files β npm install β npm run build β Restart PM2 process.
Common Issues:
GraphQL errors β Verify NEXT_PUBLIC_WORDPRESS_URL and WPGraphQL accessibility.
Images not loading β Ensure _next/image proxy is correct.
Previews not working β Double-check FAUST_SECRET_KEY.
This deployment fully leverages Next.js strengths (SSR, ISR, API routes if any) while keeping your WordPress backend separate and secure. Your Ncmaz site will be fast, SEO-friendly, and scalable.
If you encounter specific errors (PM2 logs, Nginx errors), share them for further debugging. Enjoy your headless setup! π
Last updated
Was this helpful?