Skip to main contentSkip to navigation
[email protected]
Client AreaSupport
Hosting Mammoth
HostingMammothYour Data, Our Responsibility
Home
Solutions
Hosting Services
Store
Pricing
About
Blog
API
Contact

Stay Ahead of the Curve

Get the latest insights on cybersecurity, AI innovations, and enterprise data solutions delivered to your inbox.

Hosting Mammoth
HostingMammothEnterprise Solutions

Enterprise-grade data solutions. Hosting, recovery, cybersecurity, and AI-powered services for businesses worldwide.

[email protected]
Sun - Fri, 9:00am - 5:00pm

Services

  • Cloud Hosting
  • Data Recovery
  • Cybersecurity
  • Legal Support
  • MSP Services
  • Web Development
  • AI Services
  • Free Server Migration

Hosting

  • VPS Hosting (NVMe SSD)
  • VDS Hosting (NVMe)
  • Storage VPS (High SSD)
  • GPU Servers
  • Managed Services
  • Cloud Firewall
  • Load Balancer
  • One-Click Apps
  • n8n Hosting
  • Object Storage
  • FAQ

Company

  • Store
  • Pricing
  • About Us
  • Locations
  • Blog
  • Testimonials
  • Contact
  • Affiliate Program
  • White-Label
  • Terms of Service
  • Privacy Policy
  • Browser Cookies
  • SLA

Support

  • Client Area
  • Submit Ticket
  • Knowledge Base
  • Server Status
  • API Documentation

© 2026 Hosting Mammoth. All rights reserved.

Knowledge Base
Getting StartedAccount ManagementVPS HostingGPU ServersStorage VPSCloud FirewallLoad BalancerServer ManagementBilling & PaymentsSupport & TicketsAffiliate ProgramReseller ProgramMarketplace & Appsn8n HostingManaged ServicesServer MigrationAPI & DevelopersSecurityTroubleshootingGlossaryInstall Guides
  1. Home
  2. /
  3. Support
  4. /
  5. Install Guides
  6. /
  7. How To Install Comfyui Ubuntu
GUIDEInstall Guides

How to Install ComfyUI on Ubuntu 24.04 — Node-Based Stable Diffusion on Your GPU VPS

27 min read

How to Install ComfyUI on Ubuntu 24.04 — Node-Based Stable Diffusion on Your GPU VPS

ComfyUI is the most powerful way to run Stable Diffusion, SDXL, and FLUX on your own infrastructure. Instead of a simple prompt box, it gives you a node-based graph editor where every part of the generation pipeline — model loader, sampler, VAE, conditioning, ControlNet, upscaler — is a draggable block you wire together. This guide walks you through installing ComfyUI on an Ubuntu 24.04 GPU VPS from a clean SSH session to a production-hardened deployment serving SDXL and FLUX workflows through an authenticated HTTPS endpoint.

Need a GPU VPS first? ComfyUI is GPU-bound for any practical use. Deploy a CloudCore Business GPU plan starting at EUR 29.99/month with NVIDIA acceleration and spin through this tutorial end to end.

Table of Contents

  • What is ComfyUI?
  • Why Self-Host ComfyUI on a GPU VPS?
  • Prerequisites
  • Step 1: Update System Packages
  • Step 2: Install NVIDIA GPU Drivers
  • Step 3: Install the CUDA Toolkit
  • Step 4: Install Python 3.11 and Create a Virtual Environment
  • Step 5: Clone the ComfyUI Repository
  • Step 6: Install PyTorch with CUDA Support
  • Step 7: Install ComfyUI Python Dependencies
  • Step 8: Download Your First Model Checkpoints
  • Step 9: Launch ComfyUI for the First Time
  • Step 10: Install ComfyUI-Manager
  • Step 11: Your First Text-to-Image Workflow
  • Step 12: Add ControlNet Custom Nodes
  • Step 13: Create a systemd Service
  • Step 14: Secure with Nginx Reverse Proxy
  • Step 15: Use the ComfyUI API
  • Troubleshooting
  • FAQ
  • Next Steps
  • What is ComfyUI?

    ComfyUI is an open-source, node-based interface for diffusion models. Instead of hiding the generation pipeline behind a single prompt box like AUTOMATIC1111's WebUI, ComfyUI surfaces every step — checkpoint loading, CLIP text encoding, KSampler, VAE decode — as individual nodes you connect with wires. The result is a transparent, composable graph that you can save, share, and version as a JSON file.

    ComfyUI supports the full modern diffusion stack. Stable Diffusion 1.5 and SD 2.1 run smoothly on modest GPUs. SDXL and SDXL Turbo produce 1024x1024 images with photorealistic detail. FLUX.1-schnell and FLUX.1-dev from Black Forest Labs deliver state-of-the-art prompt adherence and text rendering. Stable Video Diffusion and AnimateDiff animate still frames. ControlNet variants (Canny, Depth, OpenPose, Scribble) guide composition from reference images. IPAdapter and InstantID transfer style and identity across generations. LoRA, LyCORIS, and embeddings plug in as additional nodes.

    The practical uses are broad. E-commerce teams generate on-brand product photography at scale. Marketing departments produce ad creative variations in seconds. Game studios iterate on concept art and texture maps. Solo creators build custom image pipelines that would cost thousands per month on a hosted service. Because every workflow is a JSON file, teams version-control their "pipelines" in git the same way they version code.

    ComfyUI is written in pure Python on top of PyTorch. It is actively maintained by comfyanonymous and a large community, and the official documentation lives at docs.comfy.org.

    Why Self-Host ComfyUI on a GPU VPS?

    Paid image generation services like Midjourney, DALL-E, and hosted ComfyUI providers are convenient, but they come with compounding costs and real limitations. Running ComfyUI on your own GPU VPS gives you ownership of the entire pipeline.

    • Unlimited generations at a flat monthly price. Hosted services charge per image or per credit. Once you generate more than a few hundred images a month, a GPU VPS is dramatically cheaper. Run a batch of 10,000 variations overnight without watching a billing meter.
    • Complete creative control. You choose the base model, the LoRAs, the samplers, the schedulers, the custom nodes. Hosted services lock you into their curated list. Want to run an uncensored community checkpoint or a niche LoRA? Self-hosting is the only option.
    • Workflow portability. A ComfyUI workflow is just JSON. You can commit it to a repo, share it in a Discord, or load it as a template. No vendor lock-in.
    • API integration for real applications. ComfyUI's REST + WebSocket API means you can call it from any language. Build a product photo generator, a Discord bot, or an image-to-image batch tool without depending on a third-party SaaS.
    • Data privacy. Your prompts, reference images, and generated outputs stay on your server. Critical for clients, NDAs, or anything proprietary.
    • No content moderation filters. Hosted services block entire categories of creative work. On your own VPS you set the policy.
    • Learning the full stack. Running ComfyUI locally teaches you how diffusion really works. Every node is a concrete step in the pipeline.

    Cost Comparison: Hosted vs. Self-Hosted ComfyUI

    ScenarioMidjourney StandardRunPod Serverless ComfyUISelf-Hosted (CloudCore Business GPU)
    Monthly base$30/moPay-per-second (~$0.0005/sec)EUR 29.99/mo
    Images per month (typical)~15 hrs fastVaries by GPUUnlimited
    Cost at 5,000 images/mo$30 + overage~$50-150 depending on GPUEUR 29.99 flat
    Custom models / LoRAsNoYesYes
    Custom nodes / ControlNetLimitedYesYes
    Uncensored / NSFWNoDependsYes
    API accessLimitedYesYes (native)
    Data leaves server?YesYesNo
    For any team generating more than a couple hundred images a week, self-hosting on a GPU VPS pays for itself within the first month.

    Prerequisites

    Before you begin, make sure you have:

    • A VPS running Ubuntu 24.04 LTS with root or sudo access
    • An NVIDIA GPU attached to the VPS with at least 12 GB VRAM (RTX 3060 12GB, A4000, A10, A30, or better)
    • At least 16 GB system RAM and 50 GB free disk space (models alone can consume 20+ GB)
    • SSH access to your server
    • Basic familiarity with the Linux command line
    Recommended Plan: CloudCore Business GPU
    >
    To run SDXL and FLUX comfortably with ComfyUI-Manager and a handful of custom nodes, we recommend the CloudCore Business GPU plan:
    >
    - 8 vCPU cores
    - 32 GB RAM
    - NVIDIA GPU with 12-24 GB VRAM
    - 200 GB NVMe SSD
    - Unmetered bandwidth
    - From EUR 29.99/month
    >
    This handles SDXL 1024x1024 generations in 3-6 seconds, FLUX.1-schnell 4-step outputs in under 10 seconds, and leaves room for ControlNet, upscalers, and a couple of concurrent workflows.

    Connect to your server via SSH to get started:

    bash
    ssh root@your-server-ip

    Step 1: Update System Packages

    Start with a fully patched base system. This avoids dependency conflicts when installing NVIDIA drivers and CUDA.

    bash
    sudo apt update && sudo apt upgrade -y
    sudo apt install -y build-essential git wget curl software-properties-common

    If the kernel was upgraded, reboot and reconnect:

    bash
    sudo reboot

    Step 2: Install NVIDIA GPU Drivers

    ComfyUI needs a working NVIDIA driver before anything else. Ubuntu 24.04 ships the ubuntu-drivers utility that picks the best recommended driver for your hardware.

    bash
    sudo apt install -y ubuntu-drivers-common
    sudo ubuntu-drivers install

    This installs the recommended proprietary driver (typically the latest nvidia-driver-550 or newer). Reboot to load the kernel module:

    bash
    sudo reboot

    After reconnecting, verify the driver is live:

    bash
    nvidia-smi

    Expected output:

    text
    +-----------------------------------------------------------------------------------------+
    | NVIDIA-SMI 550.54.15              Driver Version: 550.54.15      CUDA Version: 12.4     |
    |-----------------------------------------+------------------------+----------------------+
    | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
    |=========================================+========================+======================|
    |   0  NVIDIA RTX A4000               Off | 00000000:00:05.0   Off |                  N/A |
    | 41%   35C    P8              12W / 140W |       0MiB / 16376MiB |      0%      Default |
    +-----------------------------------------+------------------------+----------------------+

    Note the CUDA Version in the top right — the driver reports the maximum CUDA runtime it supports (here 12.4). You will match the PyTorch build to this version in Step 6.

    Step 3: Install the CUDA Toolkit

    The NVIDIA driver alone is enough for PyTorch to run inference, because PyTorch wheels ship with bundled CUDA libraries. However, installing the full toolkit lets you compile custom nodes that include CUDA kernels (xformers build-from-source, some ControlNet preprocessors) and gives you nvcc for debugging.

    Add NVIDIA's CUDA apt repository:

    bash
    wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
    sudo dpkg -i cuda-keyring_1.1-1_all.deb
    sudo apt update
    sudo apt install -y cuda-toolkit-12-4

    Add CUDA to your PATH by appending to ~/.bashrc:

    bash
    echo 'export PATH=/usr/local/cuda-12.4/bin:$PATH' >> ~/.bashrc
    echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
    source ~/.bashrc

    Verify:

    bash
    nvcc --version

    Expected output:

    text
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2024 NVIDIA Corporation
    Built on Thu_Mar_28_02:18:24_PDT_2024
    Cuda compilation tools, release 12.4, V12.4.131

    Step 4: Install Python 3.11 and Create a Virtual Environment

    Ubuntu 24.04 ships Python 3.12, but ComfyUI and most custom nodes are best tested against Python 3.11. Install it from the deadsnakes PPA, which provides stable backports.

    bash
    sudo add-apt-repository -y ppa:deadsnakes/ppa
    sudo apt update
    sudo apt install -y python3.11 python3.11-venv python3.11-dev

    Create a dedicated system user for ComfyUI — never run it as root:

    bash
    sudo useradd -m -s /bin/bash comfyui
    sudo usermod -aG video,render comfyui

    Switch to the comfyui user and create a virtual environment in the home directory:

    bash
    sudo -iu comfyui
    python3.11 -m venv ~/venv
    source ~/venv/bin/activate

    Upgrade the packaging tools inside the venv:

    bash
    pip install --upgrade pip setuptools wheel

    From this point forward, every pip install happens inside the isolated venv.

    Step 5: Clone the ComfyUI Repository

    Clone the official repo from GitHub:

    bash
    cd ~
    git clone https://github.com/comfyanonymous/ComfyUI.git
    cd ComfyUI

    Expected layout:

    text
    ComfyUI/
    ├── comfy/                 # Core engine
    ├── custom_nodes/          # Where custom node packs live
    ├── models/
    │   ├── checkpoints/       # Main model files (SDXL, FLUX, SD1.5)
    │   ├── loras/             # LoRA adapters
    │   ├── vae/               # VAE weights
    │   ├── controlnet/        # ControlNet models
    │   ├── clip/              # Separate CLIP encoders (for FLUX)
    │   └── clip_vision/
    ├── web/                   # Browser UI assets
    ├── main.py                # Entry point
    └── requirements.txt

    Pin to a known-good commit if you want stability, or stay on master for the latest features:

    bash
    git log --oneline -5
    

    Optional: git checkout <commit-hash>

    Step 6: Install PyTorch with CUDA Support

    This is the step most people get wrong. You must install the PyTorch wheel built for your CUDA version. With the driver reporting CUDA 12.4, use the cu124 index:

    bash
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

    This downloads roughly 2.5 GB of CUDA-enabled libraries. Verify that PyTorch sees the GPU:

    bash
    python -c "import torch; print('CUDA available:', torch.cuda.is_available()); print('Device:', torch.cuda.get_device_name(0))"

    Expected output:

    text
    CUDA available: True
    Device: NVIDIA RTX A4000

    If CUDA available is False, the wheel was built for a different CUDA version or the driver is not loaded. Reinstall matching the driver's reported CUDA version (cu121 for driver 525+, cu124 for driver 550+).

    Optional: Install xFormers for Memory-Efficient Attention

    xFormers reduces VRAM use by 20-40% on older GPUs and speeds up sampling. It is optional on modern cards where PyTorch's built-in scaled_dot_product_attention is already fast.

    bash
    pip install xformers --index-url https://download.pytorch.org/whl/cu124

    Step 7: Install ComfyUI Python Dependencies

    Install the remaining ComfyUI requirements:

    bash
    cd ~/ComfyUI
    pip install -r requirements.txt

    Expected tail of output:

    text
    Successfully installed aiohttp-3.9.5 einops-0.8.0 kornia-0.7.3 pillow-10.4.0 psutil-6.0.0 pyyaml-6.0.2 safetensors-0.4.4 scipy-1.14.0 tqdm-4.66.5 transformers-4.44.2 ...

    This installs roughly 30 packages including transformers, safetensors, kornia, and einops. Total install size is about 1 GB on top of PyTorch.

    Step 8: Download Your First Model Checkpoints

    ComfyUI needs at least one checkpoint to generate anything. Models are not bundled — you download them into models/checkpoints/. We will grab two: SDXL for classic diffusion, and FLUX.1-schnell for state-of-the-art prompt following.

    SDXL Base 1.0 (~6.9 GB)

    bash
    cd ~/ComfyUI/models/checkpoints
    wget -c https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors

    FLUX.1-schnell (~23 GB, fp8 variant is smaller)

    For the lighter fp8 version that fits in 12 GB VRAM:

    bash
    cd ~/ComfyUI/models/checkpoints
    wget -c https://huggingface.co/Comfy-Org/flux1-schnell/resolve/main/flux1-schnell-fp8.safetensors

    FLUX also needs separate CLIP and VAE files. Place them in the matching folders:

    bash
    # CLIP encoders for FLUX
    cd ~/ComfyUI/models/clip
    wget -c https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors
    wget -c https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors

    FLUX VAE

    cd ~/ComfyUI/models/vae wget -c https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/ae.safetensors
    Some FLUX files require you to accept the license on Hugging Face. If wget returns a 401, create a free HF account, accept the model card, create a read token, and use wget --header="Authorization: Bearer hf_yourtoken".

    Verify the files landed:

    bash
    ls -lh ~/ComfyUI/models/checkpoints/

    Step 9: Launch ComfyUI for the First Time

    From the activated venv, start the server and bind to all interfaces so you can reach it from your browser:

    bash
    cd ~/ComfyUI
    python main.py --listen 0.0.0.0 --port 8188

    Expected output:

    text
    ** ComfyUI startup time: 2026-04-16 10:00:00.000000
    ** Platform: Linux
    ** Python version: 3.11.9
    ** Python executable: /home/comfyui/venv/bin/python
    ** Log file: /home/comfyui/ComfyUI/comfyui.log
    Total VRAM 16376 MB, total RAM 32098 MB
    pytorch version: 2.4.0+cu124
    Set vram state to: NORMAL_VRAM
    Device: cuda:0 NVIDIA RTX A4000 : cudaMallocAsync
    Using pytorch attention
    Starting server

    To see the GUI go to: http://0.0.0.0:8188

    Open http://your-server-ip:8188 in your browser. You should see the default ComfyUI graph with Load Checkpoint, CLIP Text Encode, KSampler, VAE Decode, and Save Image nodes already wired.

    Security note: --listen 0.0.0.0 exposes the UI to the internet with no authentication. Use it only for initial setup, then restrict access via firewall or reverse proxy in Step 14.

    Stop the server with Ctrl+C once you have confirmed it loads.

    Step 10: Install ComfyUI-Manager

    ComfyUI-Manager is a custom node that turns ComfyUI into a self-updating, self-installing platform. It adds a "Manager" button to the UI where you can browse and install custom nodes, download models directly from Hugging Face/Civitai, and update ComfyUI itself.

    Clone it into custom_nodes/:

    bash
    cd ~/ComfyUI/custom_nodes
    git clone https://github.com/ltdrdata/ComfyUI-Manager.git
    cd ComfyUI-Manager
    pip install -r requirements.txt

    Restart ComfyUI:

    bash
    cd ~/ComfyUI
    python main.py --listen 0.0.0.0

    Reload the browser — you will see a new Manager button in the right-side menu. Click it to open the node and model registry.

    Step 11: Your First Text-to-Image Workflow

    In the ComfyUI UI you should see the default text-to-image graph. Walk through the nodes:

  • Load Checkpoint — set ckpt_name to sd_xl_base_1.0.safetensors.
  • CLIP Text Encode (Positive) — enter your prompt, e.g. A photorealistic portrait of a golden retriever on a sunlit beach, 85mm lens, shallow depth of field.
  • CLIP Text Encode (Negative) — enter blurry, watermark, text, low quality, deformed.
  • Empty Latent Image — set width=1024, height=1024, batch_size=1.
  • KSampler — leave sampler_name=euler, scheduler=normal, steps=20, cfg=7.0.
  • VAE Decode — connects the sampler output to the VAE embedded in the SDXL checkpoint.
  • Save Image — writes to ComfyUI/output/.
  • Click Queue Prompt in the right panel. On an RTX A4000, a 1024x1024 SDXL image completes in about 4-6 seconds. The output appears below the Save Image node.

    Switch to FLUX.1-schnell

    FLUX uses a separate CLIP and VAE rather than the all-in-one SDXL checkpoint. The easiest path is to load the example FLUX workflow from the Manager:

  • Click Manager → Workflow Gallery → search for FLUX schnell.
  • Load the template.
  • Set the checkpoint to flux1-schnell-fp8.safetensors.
  • Set steps to 4 (FLUX schnell is a distilled 4-step model).
  • Queue the prompt.
  • FLUX renders dramatically better text in images and follows complex prompts more faithfully than SDXL.

    Step 12: Add ControlNet Custom Nodes

    ControlNet lets you steer diffusion with reference images: edge maps, depth maps, poses. It is the building block for consistent character generation, product photo composition, and img2img pipelines.

    Via ComfyUI-Manager:

  • Click Manager → Install Custom Nodes.
  • Search ControlNet Preprocessors, install comfyui_controlnet_aux by Fannovel16.
  • Click Install Models, search controlnet sdxl canny, download controlnet-canny-sdxl-1.0.safetensors (~2.5 GB) into models/controlnet/.
  • Click Restart at the top of the Manager panel.
  • In the graph:

  • Add a Load Image node and upload a reference photo.
  • Add a Canny Edge preprocessor (from the ControlNet Aux pack).
  • Add a Load ControlNet Model node pointing to the canny SDXL weights.
  • Add an Apply ControlNet node between your positive conditioning and the KSampler.
  • Queue — the output follows the edge structure of the reference image.
  • Other high-value custom nodes to install via the manager:

    • ComfyUI_IPAdapter_plus — style and identity transfer from reference images.
    • was-node-suite-comfyui — 200+ utility nodes (text tools, math, image ops).
    • efficiency-nodes-comfyui — combines common node sequences into compact blocks.
    • ComfyUI-Impact-Pack — face detailer, segmentation, inpainting helpers.
    • ComfyUI-AnimateDiff-Evolved — animate stills into short video clips.

    Step 13: Create a systemd Service

    Launching ComfyUI by hand every reboot does not scale. Package it as a systemd service that auto-starts on boot, restarts on crash, and logs to journald.

    Exit back to your sudo user:

    bash
    exit   # leave the comfyui shell

    Create the unit file:

    bash
    sudo tee /etc/systemd/system/comfyui.service > /dev/null <<'EOF'
    [Unit]
    Description=ComfyUI Stable Diffusion Node Server
    After=network-online.target
    Wants=network-online.target

    [Service] Type=simple User=comfyui Group=comfyui WorkingDirectory=/home/comfyui/ComfyUI Environment="PATH=/home/comfyui/venv/bin:/usr/local/cuda-12.4/bin:/usr/bin:/bin" Environment="LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64" Environment="PYTHONUNBUFFERED=1" ExecStart=/home/comfyui/venv/bin/python /home/comfyui/ComfyUI/main.py --listen 127.0.0.1 --port 8188 Restart=on-failure RestartSec=10

    Resource limits

    LimitNOFILE=65536

    Security hardening

    NoNewPrivileges=true PrivateTmp=true ProtectSystem=full ProtectHome=read-only ReadWritePaths=/home/comfyui/ComfyUI

    [Install] WantedBy=multi-user.target EOF

    Note that we bind to 127.0.0.1 now — public access will come through Nginx in the next step.

    Enable and start:

    bash
    sudo systemctl daemon-reload
    sudo systemctl enable --now comfyui
    sudo systemctl status comfyui

    Expected status output:

    text
    ● comfyui.service - ComfyUI Stable Diffusion Node Server
         Loaded: loaded (/etc/systemd/system/comfyui.service; enabled; preset: enabled)
         Active: active (running) since Wed 2026-04-16 10:20:00 UTC; 5s ago
       Main PID: 12345 (python)
          Tasks: 15 (limit: 38412)
         Memory: 1.8G
            CPU: 14.7s

    Tail the logs to confirm it bound successfully:

    bash
    sudo journalctl -u comfyui -f

    Step 14: Secure with Nginx Reverse Proxy

    ComfyUI has no built-in authentication. Exposing port 8188 directly on a public IP is a liability — anyone who finds it can enqueue jobs on your GPU. Put it behind Nginx with HTTPS and HTTP Basic Auth.

    Install Nginx and the htpasswd utility:

    bash
    sudo apt install -y nginx apache2-utils certbot python3-certbot-nginx

    Create an auth file:

    bash
    sudo htpasswd -c /etc/nginx/.comfyui-htpasswd comfyuser

    You will be prompted for a password.

    Write the site config — ComfyUI uses WebSockets for live progress, so we need Upgrade headers and long timeouts:

    bash
    sudo tee /etc/nginx/sites-available/comfyui > /dev/null <<'EOF'
    server {
        listen 80;
        server_name comfy.yourdomain.com;
        return 301 https://$host$request_uri;
    }

    server { listen 443 ssl http2; server_name comfy.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/comfy.yourdomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/comfy.yourdomain.com/privkey.pem;

    # Generations can return large images client_max_body_size 100m;

    # Security headers add_header X-Content-Type-Options nosniff; add_header X-Frame-Options SAMEORIGIN; add_header Referrer-Policy strict-origin-when-cross-origin;

    location / { auth_basic "ComfyUI"; auth_basic_user_file /etc/nginx/.comfyui-htpasswd;

    proxy_pass http://127.0.0.1:8188; proxy_http_version 1.1;

    # WebSocket upgrade (required for live progress bar) proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";

    # Standard proxy headers proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme;

    # Long timeouts — generations can take minutes proxy_read_timeout 600s; proxy_send_timeout 600s; proxy_buffering off; } } EOF

    sudo ln -s /etc/nginx/sites-available/comfyui /etc/nginx/sites-enabled/ sudo nginx -t

    Point your domain's A record at the VPS IP, then obtain a certificate:

    bash
    sudo certbot --nginx -d comfy.yourdomain.com
    sudo systemctl reload nginx

    Lock down the firewall so only HTTPS (and SSH) are public:

    bash
    sudo ufw allow OpenSSH
    sudo ufw allow 'Nginx Full'
    sudo ufw deny 8188
    sudo ufw enable

    Your ComfyUI instance is now at https://comfy.yourdomain.com behind Basic Auth.

    Step 15: Use the ComfyUI API

    Every workflow you build in the browser is a JSON graph. You can POST that same JSON to /prompt and trigger generations from any language. The full API lives at port 8188 (now proxied through your HTTPS endpoint).

    Export a workflow as API JSON

    In the ComfyUI UI, open Settings (gear icon) and enable Dev mode options. A new Save (API Format) button appears in the right panel. Click it to download workflow_api.json.

    Queue a prompt via curl

    bash
    curl -u comfyuser:yourpassword -X POST https://comfy.yourdomain.com/prompt \
      -H "Content-Type: application/json" \
      -d @workflow_api.json

    Expected response:

    json
    {
      "prompt_id": "c1f2e3d4-5678-90ab-cdef-112233445566",
      "number": 1,
      "node_errors": {}
    }

    Poll for results

    bash
    curl -u comfyuser:yourpassword \
      https://comfy.yourdomain.com/history/c1f2e3d4-5678-90ab-cdef-112233445566

    The response includes the output filename. Fetch the image itself:

    bash
    curl -u comfyuser:yourpassword \
      "https://comfy.yourdomain.com/view?filename=ComfyUI_00001_.png&type=output" \
      -o result.png

    For real-time progress, connect to the WebSocket at wss://comfy.yourdomain.com/ws. Libraries like websockets in Python or ws in Node.js handle this in a few lines. The official ComfyUI API examples include a full Python script that submits workflows, listens on the WS, and downloads outputs.

    Troubleshooting

    ProblemCauseSolution
    torch.cuda.is_available() returns FalsePyTorch wheel does not match CUDA versionReinstall matching driver's CUDA: pip install torch --index-url https://download.pytorch.org/whl/cu124
    CUDA out of memory on SDXLToo high resolution or batch sizeLower to 768x768, batch_size=1, or launch with python main.py --lowvram
    Model not found in Load CheckpointWrong folder, case-sensitive filename, or file still downloadingVerify with ls -lh ~/ComfyUI/models/checkpoints/ and refresh the browser
    ComfyUI UI loads but Queue Prompt does nothingWebSocket blocked by proxyConfirm Upgrade and Connection: upgrade headers in Nginx config
    Service fails with ModuleNotFoundErrorsystemd uses different PythonSet ExecStart to the full path /home/comfyui/venv/bin/python
    nvidia-smi works but xformers failsVersion mismatch with torchReinstall xformers from the same cu124 index or uninstall it — ComfyUI runs fine without
    Slow first generation, fast afterModel compile + load into VRAMExpected behavior; add --preview-method auto and keep the model loaded
    Custom node breaks ComfyUI on startupBad install or Python incompatibilityRename the offending folder in custom_nodes/ to disable, restart, then reinstall via Manager

    Checking Logs

    bash
    sudo journalctl -u comfyui -f --no-pager
    sudo journalctl -u comfyui -n 200 --no-pager

    VRAM Profiles

    ComfyUI accepts runtime flags to adapt to different GPUs:

    • --highvram — keep models resident, fastest on 24GB+ cards
    • --normalvram — default behavior
    • --lowvram — aggressive offload, for 8-12GB cards running SDXL
    • --novram — CPU + VRAM swap, for tiny GPUs (slow)
    • --cpu — no GPU at all (very slow, test only)

    FAQ

    Can I run ComfyUI without a GPU?

    Technically yes, ComfyUI accepts a --cpu flag. Practically, no. SDXL at 1024x1024 takes 2-4 seconds on an RTX A4000 but 4-8 minutes on CPU. FLUX is worse. Unless you are only testing node wiring, you need an NVIDIA GPU with at least 8 GB VRAM, and 12 GB+ is strongly recommended for SDXL and FLUX. A CloudCore Business GPU plan includes this out of the box.

    How much VRAM do I actually need for SDXL and FLUX?

    SDXL at 1024x1024 needs roughly 10 GB of VRAM with default settings, or 6 GB with --lowvram. FLUX.1-schnell in fp8 fits in 12 GB comfortably. Full fp16 FLUX.1-dev wants 16 GB or more for smooth operation. Running ControlNet, IPAdapter, and an upscaler in the same workflow can push VRAM use another 4-6 GB, which is why 16-24 GB cards are the sweet spot for serious ComfyUI use.

    Why choose ComfyUI over AUTOMATIC1111 WebUI?

    ComfyUI exposes the full diffusion pipeline as explicit nodes, giving you precise control over every step. It is measurably faster, uses less VRAM for the same output, supports FLUX and newer models on day one, and workflows are portable JSON files you can commit to git. AUTOMATIC1111's Stable Diffusion WebUI is friendlier for beginners who just want to prompt, but it hides the mechanics and updates more slowly. Most power users eventually migrate to ComfyUI once they need ControlNet chains, custom pipelines, or API access.

    Is ComfyUI safe to expose to the public internet?

    Not by default. ComfyUI has no authentication and anyone who can reach port 8188 can queue jobs on your GPU or download your model files. Always put it behind an Nginx reverse proxy with HTTPS and HTTP Basic Auth (as in Step 14), restrict access by IP with UFW, or tunnel it over a Wireguard VPN. Never leave --listen 0.0.0.0 open on a public IP without protection.

    What is ComfyUI-Manager and do I need it?

    ComfyUI-Manager is a custom node that adds a package manager to the ComfyUI interface. From a single panel you can install custom nodes, download models from Hugging Face and Civitai, update ComfyUI itself, and roll back broken installs. It is not strictly required — you can git clone every custom node manually — but almost every production ComfyUI deployment installs it. The 30 seconds it takes to install pays off the first time you want to try a new node pack.

    Can I call ComfyUI from my own application?

    Yes. ComfyUI exposes a REST API and WebSocket on port 8188. You POST a workflow JSON to /prompt, listen for executing, progress, and executed events on /ws, then fetch the output via /view. The API is what powers community tools like ComfyUI-to-Python-Extension, Discord bots, and SaaS image generation products. See script_examples/ in the ComfyUI repo for reference Python clients.

    How do I install custom nodes like ControlNet, IPAdapter, or AnimateDiff?

    The recommended way is through ComfyUI-Manager: click Manager → Install Custom Nodes, search for the pack, click Install, then Restart. For manual installs, cd ~/ComfyUI/custom_nodes, git clone the repo, activate the venv, and pip install -r requirements.txt if one is present. Restart the ComfyUI systemd service with sudo systemctl restart comfyui to pick up the new nodes.

    Next Steps

    Now that you have ComfyUI running as a production service, extend the setup:

    • Add AUTOMATIC1111 WebUI alongside — some LoRAs and community workflows target A1111 first. Install Stable Diffusion WebUI on Ubuntu on the same box and share the models/ folder via symlinks.
    • Pair with a local LLM for captioning and prompt engineering — install Ollama to run Llama 3.1 for prompt generation and image captioning entirely on your VPS.
    • Run a dedicated text inference server — vLLM handles high-throughput LLM inference if you want an OpenAI-compatible endpoint next to ComfyUI.
    • Add fast CPU inference with llama.cpp — llama.cpp complements GPU workloads with efficient CPU-based model serving.
    • Build a Discord image bot — use discord.py to POST prompts to the ComfyUI API and return images to channels. The API-first design makes this a weekend project.
    • Schedule batch generations — a simple cron job can queue overnight batches of thousands of images from a CSV of prompts.
    • Version-control your workflows — commit your workflow_api.json files to git so your team can reuse pipelines and track changes over time.

    Ready to run ComfyUI in production?
    >
    Our CloudCore Business GPU plans start at EUR 29.99/month and include the NVIDIA GPU, NVMe storage, and unmetered bandwidth you need for SDXL and FLUX workflows. Deploy, follow this guide, and you can be generating images in under an hour.
    >
    See GPU VPS plans — white-label friendly, deploy in minutes.

    Was this article helpful?

    ← Back to Install GuidesBrowse all categories →

    Still have questions?

    Contact Support →Submit a Ticket