- Published on
Deploy Next.js 15 on FASTPANEL® with Node.js 22 and Nginx
Table of Contents
- Overview
- Prerequisites
- Create a New Website
- Connect via SSH
- Install Node.js 22 and PM2
- Upload Your Next.js Project
- Build the Project
- Run the App with PM2
- Enable SSL via FASTPANEL
- Verify the Deployment
- Environment Variables
- Troubleshooting
- Done!
- Useful PM2 Commands
- Tips
Overview
In the previous article, we learned how to Deploy Laravel 12 on FASTPANEL® using PHP 8.4 and Nginx.
Now, let’s move to the modern frontend world — and see how to deploy a Next.js 15 application on the same platform, powered by Node.js 22 LTS, PM2, and Nginx reverse proxy for production mode.
This guide is perfect if you want to:
- Run your Next.js app on FASTPANEL without using Vercel
- Keep uptime and performance high with PM2 process management
- Use FASTPANEL’s built-in Let’s Encrypt SSL for automatic HTTPS
By the end of this tutorial, you’ll have a fully working Next.js 15 production build accessible via your custom domain, for example:
https://nextjs.wakserver.com
Prerequisites
Make sure you already have:
- A server with FASTPANEL® installed
- A domain pointed to your server’s IP (e.g.
nextjs.wakserver.comor main domain) - A Next.js 15 project ready for production
We’ll assume you’re logged in as the FASTPANEL admin.
Create a New Website
- Go to Create site → Create a site manually


- Fill the form:

- Domain name:
nextjs.wakserver.com - To which IP address:
will set automatically - Add www alias: choose if you using main domain
- Create email domain: choose if you want to make email domain (we’ll skip this)
- DNS account: Do not create a DNS Zone (because we using cloudflare)
- Click Next step
- We will create new user, click on User

- Fill the form User :

- Create new
- Name:
nextjsor your chosen name - Password: choose your password, we will use to login to server via SSH
- Confirm the password: same as password
- Click Save
- Now we setup for backend, click on Backend

- Backend type :
Reverse proxy - Click on
+ Add: - Type:
host - Address:
http://localhost:3001(we will use port 3001 for running NextJS) - Click Save
- Then Click Save again

- Click on Create site then go to Site Card


Connect via SSH
SSH into your server as the website owner:
ssh user@your-server-ipReplace user with the actual username where we create before.
Install Node.js 22 and PM2
In this case we will using NVM
This will install NVM with NodeJS LTS Version and update NPM to the latest.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && source ~/.bashrc && nvm install --lts && npm i -g npm@latestCheck if Nodejs and NPM was successfully installed
node -v && npm -vnextjs@jeruk:~$ node -v && npm -v
v22.21.0
11.6.2Then install PM2 globally:
npm install -g pm2Check if PM2 was successfully installed
pm2 -vnextjs@jeruk:~$ pm2 -v
6.0.13Upload Your Next.js Project
You can upload your project using one of the following methods.
Option A — FASTPANEL File Manager
- Zip your project folder (
exclude node_modules folder)

- Click on Files

- Upload the Zip file

- Extract File within
Right Clickon the file


- (Optional) you can delete zip file after successfully extracted and
index.html
Option B — Clone from Git
- Go to www directory
- Remove default folder domain
- Clone from Git within make new domain folder
cd wwwrm -rf nextjs.wakserver.comgit clone https://github.com/yourusername/your-nextjs-app.git nextjs.wakserver.comcd nextjs.wakserver.comThen install dependencies:
npm installnextjs@jeruk:~/www/nextjs.wakserver.com$ npm install
added 332 packages, and audited 333 packages in 10s
139 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilitiesBuild the Project
Run a production build:
npm run buildThis will generate a .next folder containing your optimized build output.
nextjs@jeruk:~/www/nextjs.wakserver.com$ npm run build
> nextjs@0.1.0 build
> next build --turbopack
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
▲ Next.js 15.5.6 (Turbopack)
Creating an optimized production build ...
✓ Finished writing to disk in 11ms
✓ Compiled successfully in 3.1s
✓ Linting and checking validity of types
✓ Collecting page data
✓ Generating static pages (5/5)
✓ Collecting build traces
✓ Finalizing page optimization
Route (app) Size First Load JS
┌ ○ / 5.41 kB 119 kB
└ ○ /_not-found 0 B 113 kB
+ First Load JS shared by all 117 kB
├ chunks/46d600827f558cc3.js 75.4 kB
├ chunks/47f477e3d2ef265b.js 20.4 kB
└ other shared chunks (total) 21.2 kB
○ (Static) prerendered as static contentRun the App with PM2
Start your Next.js app in production mode using PM2:
we setting nextjs will run on port 3001
pm2 start npm --name nextjs -- run start -- -p 3001nextjs@jeruk:~/www/nextjs.wakserver.com$ pm2 start npm --name nextjs -- run start -- -p 3001
[PM2] Starting /var/www/nextjs/data/.nvm/versions/node/v22.21.0/bin/npm in fork_mode (1 instance)
[PM2] Done.
┌────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼───────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ nextjs │ default │ 0.40.3 │ fork │ 359443 │ 0s │ 0 │ online │ 0% │ 33.1mb │ nextjs │ disabled │
└────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘Check if PM2 has successfully start:
pm2 lognextjs@jeruk:~/www/nextjs.wakserver.com$ pm2 log
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/var/www/nextjs/data/.pm2/pm2.log last 15 lines:
PM2 | 2025-10-21T13:38:04: PM2 log: Node.js version : 22.21.0
PM2 | 2025-10-21T13:38:04: PM2 log: Current arch : x64
PM2 | 2025-10-21T13:38:04: PM2 log: PM2 home : /var/www/nextjs/data/.pm2
PM2 | 2025-10-21T13:38:04: PM2 log: PM2 PID file : /var/www/nextjs/data/.pm2/pm2.pid
PM2 | 2025-10-21T13:38:04: PM2 log: RPC socket file : /var/www/nextjs/data/.pm2/rpc.sock
PM2 | 2025-10-21T13:38:04: PM2 log: BUS socket file : /var/www/nextjs/data/.pm2/pub.sock
PM2 | 2025-10-21T13:38:04: PM2 log: Application log path : /var/www/nextjs/data/.pm2/logs
PM2 | 2025-10-21T13:38:04: PM2 log: Worker Interval : 30000
PM2 | 2025-10-21T13:38:04: PM2 log: Process dump file : /var/www/nextjs/data/.pm2/dump.pm2
PM2 | 2025-10-21T13:38:04: PM2 log: Concurrent actions : 2
PM2 | 2025-10-21T13:38:04: PM2 log: SIGTERM timeout : 1600
PM2 | 2025-10-21T13:38:04: PM2 log: Runtime Binary : /var/www/nextjs/data/.nvm/versions/node/v22.21.0/bin/node
PM2 | 2025-10-21T13:38:04: PM2 log: ===============================================================================
PM2 | 2025-10-21T14:15:34: PM2 log: App [nextjs:0] starting in -fork mode-
PM2 | 2025-10-21T14:15:34: PM2 log: App [nextjs:0] online
/var/www/nextjs/data/.pm2/logs/nextjs-error.log last 15 lines:
/var/www/nextjs/data/.pm2/logs/nextjs-out.log last 15 lines:
0|nextjs |
0|nextjs | > nextjs@0.1.0 start
0|nextjs | > next start -p 3001
0|nextjs |
0|nextjs | ▲ Next.js 15.5.6
0|nextjs | - Local: http://localhost:3001
0|nextjs | - Network: http://45.XX.XX.XX:3001
0|nextjs |
0|nextjs | ✓ Starting...
0|nextjs | ✓ Ready in 653msIf you see Ready then Apps success to deploy. Than CTRL+C
To make sure PM2 restarts automatically after reboot:
pm2 savepm2 startupnextjs@jeruk:~/www/nextjs.wakserver.com$ pm2 save
[PM2] Saving current process list...
[PM2] Successfully saved in /var/www/nextjs/data/.pm2/dump.pm2
nextjs@jeruk:~/www/nextjs.wakserver.com$ pm2 startup
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/var/www/nextjs/data/.nvm/versions/node/v22.21.0/bin /var/www/nextjs/data/.nvm/versions/node/v22.21.0/lib/node_modules/pm2/bin/pm2 startup systemd -u nextjs --hp /var/www/nextjs/dataDon’t forget to execute Startup Script.
You can check logs anytime:
pm2 logs nextjsEnable SSL via FASTPANEL
In the FASTPANEL dashboard:
- Go to your website → Site card → SSL certificate


- Choose Let’s Encrypt then Save

- Back to Site managing and choose Settings

- Check Redirect HTTP to HTTPS than Save

After a few seconds, your site will be accessible via HTTPS.
Verify the Deployment
Open your browser and visit:
https://nextjs.wakserver.com
If everything works, you should see your Next.js app live.

You can verify PM2 status with:
pm2 listnextjs@jeruk:~/www/nextjs.wakserver.com$ pm2 list
┌────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼───────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ nextjs │ default │ 0.40.3 │ fork │ 359443 │ 25m │ 0 │ online │ 0% │ 68.1mb │ nextjs │ disabled │
└────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘Environment Variables
If your app needs .env variables, create a file named .env.production:
touch .env.productionThen add your environment values inside it, for example:
NEXT_PUBLIC_API_URL=https://api.wakserver.comNODE_ENV=productionRebuild after updating environment variables:
npm run buildpm2 restart nextjsTroubleshooting
🔹 Port already in use
Stop any existing process:
sudo lsof -i :portsudo kill -9 <PID>🔹 502 Bad Gateway
Check if the app is running:
pm2 logs nextjs🔹 SSL not activating
Ensure the domain DNS is pointed correctly and reissue the Let’s Encrypt certificate.
Done!
You’ve successfully deployed Next.js 15 on FASTPANEL®, running with Node.js 22, PM2, and Nginx reverse proxy.
Your app now auto-starts on reboot and serves traffic securely over HTTPS.
Useful PM2 Commands
pm2 restart nextjs # Restart the app
pm2 stop nextjs # Stop the app
pm2 delete nextjs # Delete the process
pm2 logs nextjs # View logs
pm2 list # List all appsTips
Update dependencies safely:
npm install && npm run build && pm2 restart nextjsKeep your server clean:
sudo apt autoremove -y
That’s it! 🚀
You now have a production-grade Next.js 15 app running beautifully on FASTPANEL® with full HTTPS, PM2 process management, and Nginx reverse proxy.