Deploy Langflow on a remote server
Learn how to deploy Langflow on your own remote server with secure web access. This guide walks you through setting up Langflow on a remote server using Docker and configuring secure web access with Caddy.
Prerequisites
- A server with a dual-core CPU and at least 2 GB of RAM. This example uses Hetzner cloud for hosting. Your deployment may vary.
Connect to your remote server with SSH
-
Create an SSH key. This key allows you to connect to your server remotely. Replace
DANA@EXAMPLE.COM
with the email address you want to associate with the SSH key._10ssh-keygen -t ed25519 -C "DANA@EXAMPLE.COM" -
In your terminal, follow the instructions to create your SSH key pair. This creates both a private and public key. To copy the public key from your terminal, enter the following command:
_10cat ~/Downloads/host-lf.pub | pbcopy -
In your remote server, add the SSH key you copied in the previous step. For example, if you are using a Hetzner cloud server, click Server, and then select SSH keys to add an SSH key.
-
To connect to your server with SSH, enter the following command.
_10ssh -i PATH_TO_PRIVATE_KEY/PRIVATE_KEY_NAME root@SERVER_IP_ADDRESSReplace the following:
PATH_TO_PRIVATE_KEY/PRIVATE_KEY_NAME
: The path to your private SSH key file that matches the public key you added to your serverSERVER_IP_ADDRESS
: Your server's IP address
-
When prompted for a key fingerprint, type
yes
. The terminal output indicates if the connection succeeds or fails. The following response was returned after connecting to a Hetzner cloud server:_10System information as of Mon May 19 04:34:44 PM UTC 2025_10_10System load: 0.0 Processes: 129_10Usage of /: 1.5% of 74.79GB Users logged in: 0_10Memory usage: 5% IPv4 address for eth0: 5.161.250.132_10Swap usage: 0% IPv6 address for eth0: 2a01:4ff:f0:4de7::1
Deploy Langflow on your server
Now that your local machine is connected to your remote server with SSH, you can install Docker, create a docker-compose.yml
file, and serve it publicly with a reverse proxy, such as Caddy.
-
Install Docker on your server. Since this example server is an Ubuntu server, it can install snap packages. If you aren't using Ubuntu or you prefer a different installation method, see the official Docker installation guide for instructions for your operating system.
_10snap install docker -
Create a file called
docker-compose.yml
, and then open it in a text editor:_10touch docker-compose.yml && nano docker-compose.ymlThe following example defines the Langflow service from the
langflow:latest
image and a Caddy service to expose Langflow through a reverse proxy.tipThe host-langflow repository offers pre-built copies of this
docker-compose.yml
andCaddyfile
, if you prefer to fork the repository to your server. -
Add the following values to
docker-compose.yml
, and then save the file._26version: "3.8"_26_26services:_26langflow:_26image: langflowai/langflow:latest_26ports:_26- "7860:7860"_26environment:_26- LANGFLOW_HOST=0.0.0.0_26- LANGFLOW_PORT=7860_26_26caddy:_26image: caddy:latest_26ports:_26- "80:80"_26- "443:443"_26volumes:_26- ./Caddyfile:/etc/caddy/Caddyfile_26- caddy_data:/data_26- caddy_config:/config_26depends_on:_26- langflow_26_26volumes:_26caddy_data:_26caddy_config: -
Create a file called
Caddyfile
._10touch Caddyfile && nano Caddyfile -
Add the following values to
Caddyfile
, and then save the file. The Caddyfile configures Caddy to listen on port 80, and forward all incoming requests to port 80 to the Langflow service at port 7860._10:80 {_10reverse_proxy langflow:7860_10} -
To deploy your server, run
docker-compose up
. When theWelcome to Langflow
message appears, Langflow is running and accessible internally athttp://0.0.0.0:7860
inside the Docker network. -
To access your Langflow server over the public internet, navigate to your server's public IP address, such as
http://5.161.250.132
. This address uses HTTP because HTTPS isn't enabled yet. -
Recommended: Enable HTTPS:
-
Modify your domain's A record to point to your server's IP address. For example:
_10Type: A_10Name: langflow_10Value: 5.161.250.132 # Set to your server's IP address -
Stop your server.
-
Modify your Caddyfile to include port
443
so Caddy can forward both HTTP (port 80) and HTTPS (port 443) requests to the Langflow service:_10:80, :443 {_10reverse_proxy langflow:7860_10} -
Start your server.
When users visit your domain, Caddy recognizes the incoming traffic and automatically routes it to your server with a secure, encrypted connection.
-
-
To exit your SSH session, type
exit
.
See also
To package your local flows into a custom Docker image, see Containerize a Langflow application.
For a step-by-step guide to deploying Langflow, including deployments to fly.io and Flightcontrol.dev, see How to Host Langflow Anywhere.