This guide explains how to deploy a Next.js application (SSR / Production Build) on Aisbir Cloud DirectAdmin hosting using a custom
server.js runner.
1. Create server.js in Your Project Root
In your local Next.js project root directory, create a file named server.js and add the following code:
server.js
2. Build Your Next.js Application Locally
Run the production build command in your terminal:.next build folder has been successfully generated.
3. Compress Project Files into a ZIP Archive
Select and compress the following files into a single.zip archive (e.g. nextjs.zip):
.nextfolderpublicfolder (if containing static assets/images)server.jsfilepackage.json&package-lock.json.envfile (if you have environment variables)
4. Upload and Extract in DirectAdmin File Manager
- Open File Manager in your DirectAdmin panel.
- Navigate to
domains->[yourdomain]->public_html. - Upload
nextjs.zipintopublic_html. - Right-click the
.zipfile and select Extract to unpack everything intopublic_html.
5. Setup Node.js App in DirectAdmin
- Open the Setup Node.js App tool in DirectAdmin.
- Click Create Application:
- Node.js Version: Select the appropriate Node version (e.g. Node 18 or Node 20).
- Application Mode: Set to
Production. - Application Root: Enter your website root path (e.g.
domains/yourdomain.com/public_html). - Application URL: Select your domain name.
- Application Startup File: Enter
server.js.
- Click Create.
- Click Run NPM Install on the Node.js configuration page to install all dependencies.
- Click Restart / Start Application.
