Close Menu

    Subscribe to Updates

    Master the web with tutorials, hosting guides, and expert insights

    What's Hot

    Top 8 Lovable Alternatives to Build Apps Faster in 2026 (Reviewed)

    March 22, 2026

    WordPress On-Page SEO Checklist for 2026: A Practical Guide That Improves Rankings

    March 21, 2026
    Stack StreamlineStack Streamline
    • Web Hosting Tips
    • Tools & Reviews
    • How To
    Stack StreamlineStack Streamline
    Home»How To»How to Deploy NiceGUI on cPanel: A Step-by-Step Guide
    How To

    How to Deploy NiceGUI on cPanel: A Step-by-Step Guide

    Kelvin JordanBy Kelvin JordanMay 24, 20254 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    How to Deploy NiceGUI on cPanel
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Deploying a NiceGUI application on cPanel can feel like trying to fit a square peg into a round hole—but with the right approach, it’s possible! NiceGUI is a fantastic Python framework for building web-based UIs quickly, but since it relies on WebSockets and a running Python backend, traditional cPanel hosting (which is optimized for PHP and static sites) doesn’t always play nice.

    In this comprehensive guide, we’ll explore multiple methods to deploy NiceGUI on cPanel, discuss potential roadblocks, and provide workarounds to get your app up and running.

    Why Is Deploying NiceGUI on cPanel Tricky?

    Before diving into solutions, let’s understand why cPanel isn’t the most straightforward choice for NiceGUI:

    1. WebSocket Dependency – NiceGUI relies on WebSockets for real-time interactivity, but many shared cPanel hosts block WebSocket connections.
    2. No Native ASGI/WSGI Support – cPanel is designed for PHP and static sites, not long-running Python apps like FastAPI (which NiceGUI uses under the hood).
    3. Port Restrictions – NiceGUI typically needs an open port (e.g., 8080), but shared hosting often restricts port access.

    Despite these challenges, we’ll explore three possible deployment methods, ranked from easiest to most advanced.

    Method 1: Using cPanel’s “Python App” Feature (If Available)

    Some cPanel hosts (like Aveshost or A2 Hosting) offer a “Setup Python App” option. Here’s how to use it:

    Step 1: Prepare Your NiceGUI App

    Your app should be structured as a standalone ASGI application. Here’s a minimal app.py:

    from nicegui import ui
    
    ui.label("Hello from NiceGUI on cPanel!")
    ui.button("Click Me!", on_click=lambda: ui.notify("Button clicked!"))
    
    # Run the app (FastAPI/Uvicorn by default)
    ui.run()

    Step 2: Upload Files to cPanel

    • Go to File Manager → Upload app.py.
    • Create a requirements.txt with:
    nicegui
    fastapi
    uvicorn

    Step 3: Set Up the Python App

    1. In cPanel, find “Setup Python App” (under “Software”).
    2. Choose Python 3.6+.
    3. Set Application root to your app’s directory.
    4. Set Application startup file to app.py.
    5. For Application Entry Point, enter app (the FastAPI instance).

    Step 4: Install Dependencies for NiceGUI on cPanel

    Option 1: Using cPanel’s GUI (No Terminal Required)

    1. Upload your requirements.txt file
      • Go to “Configuration Files” in your Python app dashboard.
      • Click “Add” and upload your requirements.txt.
    2. Install dependencies automatically
      • Click “Run Pip Install” and select your requirements.txt file.
      • cPanel will handle the installation for you.

    Option 2: Manual Installation via Terminal

    If you have SSH or Terminal access, follow these steps:

    1. Activate the virtual environment
      • Run the following command (you can find this in your Python App dashboard in cPanel): source /home/username/virtualenv/app/3.6/bin/activate && cd /home/username/app
      • Replace username and 3.6 with your actual username and Python version.
    2. Install dependencies manually
      • Once inside the virtual environment, run: pip install -r requirements.txt
      • This will install all the required packages (NiceGUI, FastAPI, Uvicorn, etc.).

    Step 5: Restart & Access Your App

    • Restart the app in cPanel.
    • Visit the provided URL (e.g., yourdomain.com/python-app).

    ⚠️ Potential Issues:

    • If WebSockets are blocked, interactive features may fail.
    • Some hosts kill long-running processes.

    Method 2: Running NiceGUI as a Background Process (SSH Required)

    If your cPanel allows SSH access, you can manually run NiceGUI in the background.

    Step 1: Upload Your App

    • Upload app.py via File Manager.

    Step 2: Install NiceGUI via SSH

    pip install nicegui --user

    Step 3: Run the App Persistently

    Use screen or tmux to keep it running after disconnecting:

    screen -S nicegui_app
    python app.py --port=8000  # Use an available port

    Detach with Ctrl+A, D.

    Step 4: Proxy Requests via .htaccess (Optional)

    If cPanel allows reverse proxy rules, add this to .htaccess:

    RewriteEngine On
    RewriteRule ^nicegui(.*)$ http://localhost:8000$1 [P]

    Now, visit yourdomain.com/nicegui.

    ⚠️ Limitations:

    • Requires SSH access (not always available).
    • If the server restarts, your app stops.

    Method 3: Use a Subdomain with Reverse Proxy (Advanced)

    If your host allows custom reverse proxies, you can route a subdomain to NiceGUI.

    Step 1: Run NiceGUI on a Local Port

    python app.py --port=12345

    Step 2: Configure Reverse Proxy in cPanel

    1. Go to Domains → Subdomains → Create nicegui.yourdomain.com.
    2. In .htaccess, add:
    <IfModule mod_proxy.c>
       ProxyPass / http://localhost:12345/
       ProxyPassReverse / http://localhost:12345/
    </IfModule>

    Now, access your app at nicegui.yourdomain.com.

    Alternative: Deploy NiceGUI Elsewhere (Recommended)

    If cPanel proves too limiting, consider:

    • VPS – Full control over ports & processes.
    • Render/Heroku – Easy Python app deployment.
    • Fly.io – Great for WebSocket apps.

    Example VPS deployment:

    python3 -m pip install nicegui
    python3 app.py --host=0.0.0.0 --port=80

    Final Thoughts

    While NiceGUI on cPanel is possible, it’s not always smooth. If you must use cPanel, Method 1 (Python App) is the easiest. For reliability, a VPS or cloud host is better.

    Got stuck? Drop a comment below, and I’ll help troubleshoot! 🚀

    #cPanelTips #NiceGUI #PythonHosting #PythonWebDev
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleHow to Fix 404 Errors in WordPress (Even If You’re Not a Techie)
    Next Article 10 Smart Ways to Get a Free Domain Name for Your Website
    Kelvin Jordan

    Kelvin Jordan is a tech enthusiast, blogger, and digital strategist with a passion for simplifying complex ideas. With years of experience in web technologies, cybersecurity, and digital tools, Kelvin breaks down the tech world into practical guides and insights for everyday users.

    Related Posts

    How To

    Top 8 Lovable Alternatives to Build Apps Faster in 2026 (Reviewed)

    March 22, 2026
    How To

    WordPress On-Page SEO Checklist for 2026: A Practical Guide That Improves Rankings

    March 21, 2026
    AI for Websites

    How to Create AI SEO Content Briefs That Actually Rank in 2026

    March 20, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    10 Smart Ways to Get a Free Domain Name for Your Website

    June 6, 2025222

    How to Deploy NiceGUI on cPanel: A Step-by-Step Guide

    May 24, 202558

    How to Choose the Right Web Hosting Provider

    April 18, 202558
    Latest Reviews
    Web Hosting Tips

    How to Choose the Right Web Hosting Provider

    Kelvin JordanApril 18, 2025

    Subscribe to Updates

    Master the web with tutorials, hosting guides, and expert insights

    Facebook Mastodon
    • Home
    • Web Hosting Tips
    • Tools & Reviews
    • How To
    • Articles
    • Contact Us
    © 2026 Stack streamline.

    Type above and press Enter to search. Press Esc to cancel.