CloudLinux on our shared hosting servers supports Node.js applications. You can run Express, Next.js, Fastify, and other Node.js frameworks directly from your shared hosting account.
Prerequisites
- A shared hosting plan with CloudLinux and Node.js support
- SSH access enabled on your account (available on all plans)
- Your Node.js application code ready to deploy
Setting Up a Node.js Application
Step 1: Access the Node.js Selector
- Log in to DirectAdmin
- Navigate to Extra Features or Advanced Features
- Click Setup Node.js App or Node.js Selector
Step 2: Create a New Application
- Click Create Application
- Configure the settings:
- Node.js version — Select from available versions (18.x, 20.x, etc.)
- Application mode — Production or Development
- Application root — The directory containing your app (e.g.,
/home/username/myapp) - Application URL — The URL path (e.g.,
yourdomain.comoryourdomain.com/app) - Application startup file — Usually
app.js,server.js, orindex.js
- Click Create
Step 3: Install Dependencies
After creating the app:
- Click Run NPM Install in the Node.js Selector interface
- Or connect via SSH and run:
cd ~/myapp
npm installStep 4: Start the Application
- In the Node.js Selector, click Start App or Restart
- Visit your domain to verify the app is running
Managing Your Node.js App
Starting and Stopping
- Use the Start, Stop, and Restart buttons in the Node.js Selector
- Or via SSH:
cd ~/myapp
npm startViewing Logs
Application logs can be found at:
/home/username/myapp/stderr.logOr check via SSH:
tail -100 ~/myapp/stderr.logEnvironment Variables
Set environment variables in the Node.js Selector interface or create a .env file in your application root.
Package Management
Installing Packages
Via SSH:
cd ~/myapp
npm install expressUpdating Packages
cd ~/myapp
npm updateTips for Node.js on Shared Hosting
- Use production mode — Set
NODE_ENV=productionfor better performance - Handle port configuration — The hosting environment assigns the port automatically; use
process.env.PORT - Keep dependencies minimal — Avoid unnecessary packages to stay within resource limits
- Use process managers wisely — The CloudLinux Node.js Selector handles process management for you
- Monitor resource usage — Node.js apps can consume significant memory; check your CloudLinux limits
Troubleshooting
Application Returns 503 Error
- Check the application logs for errors
- Verify the startup file path is correct
- Ensure all dependencies are installed (
npm install) - Restart the application
Module Not Found
- Run
npm installfrom the application root directory - Check that
package.jsonlists the required module
Application Crashes on Start
- Check
stderr.logfor error details - Ensure you are using a compatible Node.js version
- Test your app locally before deploying
Related Articles
Need help? Contact our support team at [email protected] or open a ticket at https://domainindia.com/support.