DocumentationWhat payment methods does Hostednode accept?What are Hostednode's billing cycles?When is the monthly renewal charge generated?When are services suspended for non-payment?When is a service deleted for non-payment?What should you do if a payment method is unavailable?Are all services subject to VAT?Do you issue receipts or invoices?How to create a customer account on HostednodeDo you accept cryptocurrency payments?How to Access DirectAdmin and Explore the Panel’s Main FeaturesHow to Configure PHP for Subdomains and Additional Domains in DirectAdminHow to change the PHP version and settings in DirectAdminHow to Create an Email Account in DirectAdminHow to use the DirectAdmin API with Codex or ClaudeHow to Enable and Use Redis in DirectAdminHow to add a domain alias and use it for email in DirectAdminHow to Add an Additional Domain in DirectAdminHow to Add an Additional User to an Existing Database in DirectAdminHow to configure an autoresponder in DirectAdminHow to Set Up a Vacation Message in DirectAdminHow to Create a Subdomain in DirectAdminHow to Create a Cron Job in DirectAdminHow to create a database and associate its user in DirectAdminHow to Create an FTP Account in DirectAdminHow to Create a Mailing List in DirectAdminHow to create an email forwarder in DirectAdminHow to Create a Site Redirect in DirectAdminHow to Install WordPress with Softaculous WordPress Management in DirectAdminHow to Install WordPress with the DirectAdmin WordPress ManagerHow to Modify MX Records to Use Google Workspace in DirectAdminHow to Review the Web Application Firewall and Create a Rule Exception in DirectAdminHow to Check Account Resource Usage in DirectAdminHow to Use the ClamAV Antivirus from DirectAdminHow to Create Custom DNS Records in DirectAdmin: DKIM, SPF, and DMARCHow to use the built-in terminal in DirectAdminHow to Create a Password-Protected Directory in DirectAdminHow to Create a DMARC Record in DirectAdminHow to Create an SPF Record in DirectAdminHow to Install and Deploy a Node.js Application with NGINX Unit in DirectAdminHow to Install and Deploy a Python Application with NGINX Unit in DirectAdminHow to Use the DirectAdmin File ManagerHow to view site logs in DirectAdmin’s Site Summary and LogsHow to Enable Two-Step Authentication in DirectAdminHow to Set Up an SSH Key with DirectAdminHow to Use Backup and Restore in DirectAdminHow to Use DirectAdmin Nginx Templates
TUTORIAL

How to Install and Deploy a Python Application with NGINX Unit in DirectAdmin

Prepare a Python WSGI application, select its version and entry point in NGINX Unit, and check the route. Requires Terminal/SSH.

Nginx Unit runs Python applications from DirectAdmin. This guide uses a simple WSGI application with no additional packages, allowing you to check the entire process before deploying a project with more dependencies.

The control panel address, server name, domain, username, versions, limits, and available tools may vary depending on your service. Use the details in your hosting welcome email.

To open the panel's console and find your way around folders, see How to use the terminal included in DirectAdmin

1. Check Python and prepare the files

Open System Info & Files → Terminal, connect to the console, and run python3 --version. Then check the Python versions offered when creating an application in Nginx Unit. The project's interpreter and the selected module must be compatible; having python3 in Terminal does not guarantee that every version is available in Nginx Unit.

Create a new folder outside public_html. Replace tudominio.example with your account's actual domain:

bash
DOMINIO="tudominio.example"
mkdir "$HOME/domains/$DOMINIO/python-tutorial"
cd "$HOME/domains/$DOMINIO/python-tutorial"

In the File Manager, open that folder, create wsgi.py, and save the following content:

python
def application(environ, start_response):
    body = 'Aplicacion Python funcionando con Unidad Nginx\n'.encode('utf-8')
    start_response('200 OK', [
        ('Content-Type', 'text/plain; charset=utf-8'),
        ('Content-Length', str(len(body))),
    ])
    return [body]

The file defines application, the WSGI function that Nginx Unit will call to handle each request. This example uses only the Python standard library.

2. Configure the application in the panel

On the dashboard, open Advanced Features → Nginx Unit and click Create Application.

Close-up of the Nginx Unit icon under Advanced Features.
Open Nginx Unit to register the Python application.
  • Name: pythontutorial. Use a simple name without spaces or hyphens.

  • Type: Python.

  • Version: select the available version that matches your project. The screenshots use Python 3.10; the options may vary depending on your service.

  • Path: the folder containing wsgi.py, for example /domains/TU_DOMINIO/python-tutorial/ in the panel's selector.

  • Module: wsgi, without adding .py.

  • Callable: application, exactly as the function is named in wsgi.py.

Click Create and wait for confirmation. Check that pythontutorial appears in the list with the correct directory. Open its configuration to review Path, Module, and Callable.

Python configuration with the project folder, wsgi module, and application function.
Enter the module without the .py extension; Callable must match the function in the file.

If your project requires external packages, first prepare a virtual environment with the same major and minor Python version as the Nginx Unit module. Install the project's dependencies in it and use Home in the application configuration to specify the path to that environment. The example in this article does not need that field. An ASGI application requires its own specific configuration; do not simply rename its file to treat it as WSGI.

3. Link a route to the application

In Nginx Unit, click Create Route, select pythontutorial under Application, and review the JSON tab. To handle only /python-tutorial/, the rule must map that prefix to the application:

json
[
  {
    "match": {"uri": "/python-tutorial/*"},
    "action": {"pass": "applications/tudominio.example_pythontutorial"}
  }
]

Replace tudominio.example with your domain and use the application identifier suggested by the panel. Keep the existing rules; if there is already a list, add the corresponding entry without deleting the others. Check that match.uri restricts requests to the prefix you want to use.

JSON route editor with the /python-tutorial/* prefix directed to the Python application.
The public route must point to the application's actual name.

Click Create or Save and wait for the web configuration to take effect. The domain's route should appear under Routes.

4. Verify the deployment

Open your domain's HTTPS address ending in /python-tutorial/. The application in this article responds with:

text
Aplicacion Python funcionando con Unidad Nginx

If you receive a 404, check the domain, URL, and route match. If there is a startup error, check the Python version, folder, module without its extension, function name, and dependencies. An error when saving requires you to first correct the value flagged by the panel.

Nginx Unit manages the application's processes; you can close Terminal after checking the result. If the required Python module is unavailable, contact support to discuss your hosting options.