Skip to content

Node.js, Python, and Ruby ​

Use this page to run Node.js, Python, or Ruby applications in your hosting account, e.g. an Express API, a Flask/Django app, or a Rails/Sinatra app. Each application answers on a URL of your domain.

When this menu is available ​

The sidebar menu appears when your package includes Node.js, Python, or Ruby:

Package includesMenu name
Node.js and/or PythonNode.js & Python
Ruby (with or without the others)Node.js, Python & Ruby

If the page shows "No application runtimes on this server yet", your hosting provider has not installed runtimes on your server. If some runtimes are not in your package, the page shows "Some runtimes are not included in this account's package."

How it works ​

  • Each application runs as your account's user from its own folder in your home folder.
  • The account's CPU, RAM, IO, and process limits still apply.
  • The application gets a local port through the PORT variable (and HOST=127.0.0.1). The web server forwards requests from the domain to that port.
  • The application is restarted automatically when it stops because of an error.
  • Every settings change restarts the application.
RuntimeHow it runsDefault startup file
Node.jsnode <startup file>, NODE_ENV follows the modeapp.js
Pythongunicorn (2 workers) with a WSGI entry point, in a virtualenvpassenger_wsgi.py, entry point application
RubyPuma with config.ru, RACK_ENV follows the modeconfig.ru

The application must listen on PORT

A Node.js application must read its port from the PORT variable, not use a fixed port. Example: app.listen(process.env.PORT). For Python and Ruby, gunicorn and Puma handle this.

Creating an application ​

  1. Click New Node.js app, New Python app, or New Ruby app for the runtime you need.

  2. Fill in the form:

    FieldNotes
    Application directory (in home)The application folder in your home folder, outside public_html, e.g. apps/api. Created if missing.
    DomainThe domain the application answers on.
    URL pathThe path on the domain, e.g. /api. Empty means the domain root.
    Runtime version (e.g. Node.js version)The Node.js, Python, or Ruby version installed on the server.
    Mode (Node.js, Ruby)production or development.
    WSGI entry point (Python)The WSGI object name, e.g. application or app.
    Startup fileThe file to run, e.g. app.js, passenger_wsgi.py, or config.ru.
    Environment variablesOne NAME=value per line. Names may only contain letters, digits, and underscores.
  3. Click Create.

If the folder does not exist yet, the panel creates it. A sample startup file is only created for the default names app.js, passenger_wsgi.py, and config.ru when that file is missing. Existing files are not overwritten.

Any other startup file (e.g. server.js) must already exist and must not be empty. Otherwise creating or changing the application is refused with "startup file ~/… not found; upload the application first or check the application root" or "startup file ~/… is empty; upload the application or pick its real startup file". Upload your application first, or fix the Application directory so it points to the folder with the real startup file. For Python, the panel also creates a virtualenv with gunicorn. For Ruby, the panel prepares a gem folder with Puma.

The application then answers on https://myshop.com/api (matching the domain and path you chose).

Location rules

  • The application folder cannot be inside public_html, in a dot folder (e.g. .config), or in a system folder of your home.
  • Each domain and URL path pair must be unique.
  • The URL path cannot be under /.well-known.
  • An application at the domain root replaces that website's PHP and static files.

Installing dependencies ​

After uploading your code (with the File Manager, SFTP, or Git), click the dependency button on the application row:

RuntimeButtonFile read
Node.jsnpm installpackage.json
Pythonpip install -rrequirements.txt
Rubygem install -g GemfileGemfile

The command runs as your account's user, and its output is shown in the panel.

Starting, stopping, and restarting ​

The application table shows the Application, Runtime, and Status:

StatusMeaning
runningThe application is active.
startingThe application is starting up.
stoppedThe application is turned off.
crashedThe application stopped because of an error. Check the log.

Buttons on each row:

  • Start to start a stopped application;
  • Restart and Stop for a running application;
  • Log to see the application log (output and errors);
  • Edit to change settings, then Save and restart;
  • Remove to delete the application.

Application crashed?

Open the Log first. Common causes: dependencies not installed, a wrong startup file, or the application not listening on PORT.

INFO

Remove only removes the application from the panel and the web server. The files in the application folder stay in your home folder.

CloudLinux servers ​

On CloudLinux servers, Node.js and Python use the CloudLinux selector, while Ruby still uses the MoorCP runtime. The page and steps are the same. The Log button is only available for applications run by the MoorCP runtime.

Applications moved from cPanel ​

When your account is imported from cPanel, Node.js, Python, and Ruby applications from the cPanel Application Manager or the CloudLinux selector are registered again with the same directory, domain, URL, startup file, mode, and environment variables. Check them on this page after the move. If the old application root pointed to the wrong folder, creating it is refused as described in Creating an application; fix the folder or the startup file, then create it again.

See also ​

MoorCP Shared, a shared hosting panel for server fleets.