Short answer: To self-host Dify, use a VPS with at least 2 CPU cores and 4 GiB of RAM (Hostinger's KVM 2 qualifies, KVM 1 does not), install Docker, clone Dify, copy .env.example to .env, change the default database password and run docker compose up -d. Then put Caddy in front for HTTPS and close the raw port.
Disclosure: the Hostinger and AICredits links are affiliate links. The install steps come from Dify's documentation and its .env.example, read on 23 Oct 2026. I have not run this install on a Hostinger VPS for this post, so treat the commands as documented-but-unrun here, and read the Dify release notes before you upgrade.
Dify is a workspace for building, publishing and monitoring AI apps: visual workflows and chatflows, agents, and a knowledge base for retrieval. If you've tried it on your laptop and want a version your team can reach, a VPS is the cheapest route. Picking the plan is covered in the Hostinger plan sizing guide.
What does Dify need from the server?
From Dify's Docker Compose guide:
- At least 2 CPU cores and 4 GiB of RAM.
- Docker Compose 2.24.0 or later (
docker compose versionshows it). git,curlandjqfor the clone command.
Hostinger's pricing page lists a "Docker and Traefik" template and a Dify application template as of 23 Oct 2026. If you pick the Dify template, you skip the Docker install below, but I haven't used it, so I can't tell you what it configures. The manual route works on a plain Ubuntu VPS and teaches you where things live. Either way, the steps from "change the password" onwards still apply.
How do you install Dify with Docker Compose?
SSH into the server. Install Docker using Docker's official Ubuntu instructions, then:
git clone --branch "$(curl -s https://api.github.com/repos/langgenius/dify/releases/latest | jq -r .tag_name)" https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
That clone command is straight from Dify's docs. It pins you to the latest release tag rather than the moving main branch. If it fails with fatal: Remote branch null not found in upstream origin, the docs tell you to look up the version number on the releases page and clone with --branch <version>.
Before you start anything, edit .env:
- Change
DB_PASSWORD. The example file ships withDB_PASSWORD=difyai123456. Anyone who has read the repository knows it. Set a long random value now, because the database initialises with the first value it sees. - Leave
SECRET_KEYempty unless you have a reason. The comment in the file says leaving it empty auto-generates a persistent key in the storage directory.
Then start it and check:
docker compose up -d
docker compose ps
Each container should show Up or healthy. The init_permissions container should show Exited, which the docs say is expected.
Open http://your_server_ip/install to create the admin account. Do this immediately: until you do, whoever finds the server first can create it.
How do you add HTTPS with Caddy?
By default Dify's bundled nginx listens on port 80 (EXPOSE_NGINX_PORT=80 and EXPOSE_NGINX_SSL_PORT=443 in the example file). Caddy needs those ports, so move Dify's nginx first. In .env:
EXPOSE_NGINX_PORT=8080
Restart with the sequence the docs give for config changes:
docker compose down
docker compose up -d
Install Caddy from its official instructions, point a DNS A record for your domain at the server's IP, and set this Caddyfile (replace the domain):
dify.example.com {
reverse_proxy localhost:8080
}
Caddy's docs say it will try to get a publicly trusted certificate for non-localhost domains as long as your DNS records point at the machine and ports 80 and 443 are open to the public and directed toward Caddy. Reload Caddy after editing, and test https://dify.example.com/install.
Two things I can't confirm from the docs I read: whether CONSOLE_API_URL and APP_WEB_URL (both empty in the example file) need to be set to your HTTPS domain for every feature to work behind a proxy, and whether any link Dify generates will use the right scheme without them. If a login redirect or an image link points at http://, set those two variables to https://dify.example.com and restart.
Which ports should you close?
Hostinger's page says every VPS plan includes firewall management. Use it:
- Allow 22 (SSH, ideally restricted to your IP), 80 and 443.
- Block 8080, so the only way in is through Caddy.
Docker publishes container ports by editing the firewall itself, which means a host-level rule like ufw deny 8080 can be bypassed. A cloud-panel firewall in front of the server doesn't have that problem. More in the VPS hardening checklist.
How do you connect a model, in rupees?
Dify talks to models through providers. For an OpenAI-compatible endpoint, add the provider in Dify's settings with base URL https://api.aicredits.in/v1 (keep the /v1) and an sk- key. The exact field names and a smoke test are in the Dify, n8n and Open WebUI AICredits setup.
If you don't have an international card, AICredits lets you top up in INR by UPI from ₹50 and gives you one key for 300+ models. Set a rupee budget on the key you paste into Dify, since anyone in your workspace can spend it. A zero-forex card is the cheaper per-token route if you have one, covered in the credit card guide.
How do you back up and update?
Dify keeps data in Docker volumes and bind mounts under its docker directory. Back up that directory and the database before upgrading. Restic backups for an AI server shows a routine.
For upgrades, Dify's page says steps vary between releases, so read the release notes first. It also tells you to compare .env.example with your .env for new variables and, if you edited docker-compose.yaml, to re-apply your edits on top of the new release's file rather than keeping the old one.
Is this the right tool for you?
Choose Dify if you want a visual builder for RAG chatbots and workflows that non-developers can edit. If you want code-first control, use a framework. If you mostly want to chain APIs and webhooks, n8n on the same kind of VPS may fit better. The Dify vs LangChain vs LlamaIndex comparison covers the trade-offs.
Ready to host it? Get a KVM 2 VPS and follow the steps above.



