cPanel supports hosting Node.js and Python applications alongside traditional PHP websites. This allows you to run Express.js APIs, Django/Flask web apps, and other modern application frameworks.
Please note: Screens and options may vary slightly depending on your cPanel version and hosting plan.⚠️ Caution: Incorrect changes here can make your website inaccessible. If you are unsure about any step, please contact our support team before proceeding.
Setting Up a Node.js Application
- Log in to your cPanel account.
- In the Software section, click Setup Node.js App.
- Click Create Application.
- Configure the settings:
- Node.js version — Select the required version. - Application mode — Development or Production. - Application root — The directory containing your app files (e.g. myapp). - Application URL — The URL path where the app will be accessible. - Application startup file — The entry point (e.g. app.js or server.js).
- Click Create.
Installing Dependencies
After creating the app, click Run NPM Install to install packages from your package.json.
Environment Variables
Click Add Variable to set environment variables (e.g. NODE_ENV=production, PORT=3000, database connection strings).
Setting Up a Python Application
- In the Software section, click Setup Python App.
- Click Create Application.
- Configure the settings:
- Python version — Select the required version. - Application root — The directory containing your app files. - Application URL — The URL path. - Application startup file — The WSGI entry point (e.g. passenger_wsgi.py for Passenger, or app.py). - Application Entry point — The WSGI callable (typically application).
- Click Create.
Installing Dependencies
Click Run Pip Install or use the virtual environment to install packages from requirements.txt:
source /home/username/virtualenv/myapp/bin/activate
pip install -r requirements.txt
How It Works
cPanel uses Phusion Passenger to serve Node.js and Python applications. Passenger manages your application processes, restarts them if they crash, and proxies HTTP requests to your application.
Restarting Your Application
If you make code changes, restart the application:
- Go to the Setup Node.js/Python App page.
- Click the Restart button next to your application.
Or create/touch a restart.txt file:
touch ~/myapp/tmp/restart.txt
Tips
- Static files (CSS, JS, images) should be served by Apache rather than your application for better performance. Configure your application's directory structure accordingly.
- Use environment variables for sensitive configuration (database passwords, API keys) rather than hardcoding them.
- Monitor your application's resource usage — Node.js and Python apps can consume significant CPU and memory.
- Check your error logs and application logs if the app doesn't start or returns errors.
- Not all hosting plans include Node.js/Python support. If you don't see these options, contact your hosting provider.
What Next?
- Selecting and Configuring PHP Versions — Managing PHP alongside other languages.
- Setting Up Cron Jobs — Schedule background tasks for your application.