LibreChat gives you the ChatGPT interface and Ollama runs the model on your own hardware. LiteLLM sits between them as an OpenAI-compatible gateway, and SearXNG lets the model search the live web without an API key. Wired together, that’s a private chat assistant that can answer “what changed this week” questions while your prompts and search queries stay on hardware you control.
The catch is the web search link. LibreChat refuses private addresses for search traffic, SearXNG ships with its JSON API switched off, and the UI will not run a search until a scraper is configured as well. This LibreChat Ollama guide runs all four services, plus a self-hosted Firecrawl scraper, as one Docker Compose stack. It includes the exact librechat.yaml and settings.yml that ran and the three errors we hit with their fixes. I confirmed the setup working on Ubuntu 26.04 in November 2026, and every command below was rerun from an empty directory before publishing.
Trace a search request through the stack
Only nginx faces the network, and LibreChat listens on loopback behind it. Every other container sits on the Compose network and is reached by its service name, so the request path matters more than any one service. When you turn on web search and send a question, LibreChat runs four hops in order:
- The browser sends the prompt over HTTPS to nginx, which proxies it to LibreChat on
127.0.0.1:3080. - LibreChat asks SearXNG for results at
http://searxng:8080/search?format=json, and SearXNG fans the query out to Brave, Google, Bing and the rest of its engines. - LibreChat sends the top result URLs to Firecrawl at
http://firecrawl:3002/v2/scrape, which renders each page in a headless Chromium and returns markdown. - LibreChat passes the scraped text and your question to LiteLLM at
http://litellm:4000/v1, and LiteLLM forwards it to Ollama on port 11434.
MongoDB keeps users and conversations, and Meilisearch indexes chat history for the sidebar search. Neither one is on the search path, which is why they are drawn with dashed wires in the diagram below.

Why put LiteLLM in the middle when LibreChat can talk to Ollama directly? Because it gives you one OpenAI-style endpoint and one key for every model you’ll add later, local or hosted, plus spend tracking and fallbacks. If you only ever run one local model, you can point LibreChat at Ollama and skip it. Our LiteLLM vs Bifrost gateway benchmark covers what that layer costs in latency.
Prerequisites and sizing
You’ll need a Linux host with Docker Engine and the Compose plugin, a domain name with an A record pointing at the server, and ports 80 and 443 reachable from the internet for the Let’s Encrypt HTTP-01 challenge. Any DNS provider works. If Docker is not installed yet, follow our guide to install Docker and Docker Compose on Ubuntu and Debian first. The stack used these versions:
docker --version
docker compose version
lsb_release -ds
The lab host printed the following:
Docker version 29.9.3, build 5457199
Docker Compose version v5.7.1
Ubuntu 26.04.1 LTS
Memory is the number that decides whether this works, and Firecrawl drives it more than the model does. We started on an 8 GB VM and Firecrawl’s queue worker refused jobs with Can't accept connection due to RAM/CPU load once the host dropped below about 1.9 GB available. Moving to 16 GB fixed it. The table shows what each container used at idle on the 16 GB host with the model loaded:
| Container | Memory at idle | What drives it |
|---|---|---|
| firecrawl | 2.874 GiB | Workers per queue and concurrent jobs |
| ollama | 934.5 MiB | Model size and context length |
| litellm | 695.2 MiB | Mostly fixed, grows with concurrency |
| firecrawl-playwright | 461.9 MiB (2 GiB cap) | Open browser pages |
| librechat | 359 MiB | Active users and streams |
| chat-mongodb | 219.3 MiB | Conversation history |
| firecrawl-rabbitmq | 155.4 MiB | Queue depth |
| searxng | 133.1 MiB | Mostly fixed |
| firecrawl-postgres | 123 MiB | Job history |
| chat-meilisearch | 76.5 MiB | Indexed messages |
| firecrawl-redis | 30.2 MiB | Rate-limit keys |
The host reported 5.8 GiB used in total with a 0.5B model on 4 vCPU and 16 GB RAM. Treat that as a floor for following along, not a production recommendation. The real driver is the model: a 7B or 8B model at 4-bit quantization wants another 5 to 6 GB of RAM or VRAM on top, and CPU inference that took 3.4 seconds for a short reply here gets slow fast with bigger models. For a team, plan for a GPU host for Ollama and keep the rest of the stack on 16 to 32 GB. Our Ollama models cheat sheet lists which models fit which VRAM budget.
Lay out the project directory and secrets
Everything lives in one directory: the Compose file, LibreChat’s config, the LiteLLM model list and the SearXNG settings. Start by setting your hostname once, since it goes into LibreChat’s environment and the nginx config later. Replace chat.example.com with the name your A record points to:
export DOMAIN="chat.example.com"
export EMAIL="[email protected]"
Create the directories before the first start. The logs, images and uploads folders have to exist and belong to your user, because LibreChat will run with your UID and Docker would otherwise create them as root:
mkdir -p ~/librechat/{litellm,searxng,logs,images,uploads}
cd ~/librechat
Now write the non-secret settings into .env. These lines append, so run them once in the empty directory; a second run duplicates every key. SCHEDULES_SINGLE_PROCESS=true stops LibreChat from logging that its scheduler isn’t started, and the UID and GID lines are what fix the log permission error covered in the troubleshooting section:
echo "HOST=0.0.0.0" >> .env
echo "PORT=3080" >> .env
echo "DOMAIN_CLIENT=https://${DOMAIN}" >> .env
echo "DOMAIN_SERVER=https://${DOMAIN}" >> .env
echo "ALLOW_REGISTRATION=true" >> .env
echo "ALLOW_EMAIL_LOGIN=true" >> .env
echo "SCHEDULES_SINGLE_PROCESS=true" >> .env
echo "SEARXNG_INSTANCE_URL=http://searxng:8080" >> .env
echo "FIRECRAWL_API_URL=http://firecrawl:3002" >> .env
printf "UID=%s\nGID=%s\n" "$(id -u)" "$(id -g)" >> .env
Then generate the secrets. LibreChat encrypts stored credentials with CREDS_KEY and CREDS_IV, so do not change those two after users start saving keys. The LiteLLM master key starts with sk- because LiteLLM expects that prefix, and the Firecrawl key is any string, since the self-hosted Firecrawl doesn’t check it:
echo "CREDS_KEY=$(openssl rand -hex 32)" >> .env
echo "CREDS_IV=$(openssl rand -hex 16)" >> .env
echo "JWT_SECRET=$(openssl rand -hex 32)" >> .env
echo "JWT_REFRESH_SECRET=$(openssl rand -hex 32)" >> .env
echo "MEILI_MASTER_KEY=$(openssl rand -hex 16)" >> .env
echo "LITELLM_MASTER_KEY=sk-$(openssl rand -hex 24)" >> .env
echo "FIRECRAWL_PG_PASSWORD=$(openssl rand -hex 16)" >> .env
echo "FIRECRAWL_API_KEY=fc-selfhosted-$(openssl rand -hex 8)" >> .env
chmod 600 .env
Running cut -d= -f1 .env should list 19 keys, from HOST down to FIRECRAWL_API_KEY. Don’t source this file in your shell. Bash treats UID as read-only and stops with UID: readonly variable, which is why later commands pull single keys out with grep instead.
Point LiteLLM at Ollama
On the LiteLLM side, one model entry is enough. The public name qwen2.5-0.5b is what LibreChat will see, and the ollama_chat/ prefix tells LiteLLM to use Ollama’s chat endpoint at the Compose service address. Open the file:
vim litellm/config.yaml
Add the model list and read the master key from the environment, so the key never sits in the file:
model_list:
- model_name: qwen2.5-0.5b
litellm_params:
model: ollama_chat/qwen2.5:0.5b
api_base: http://ollama:11434
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
We picked the 0.5B Qwen model because it runs on any CPU and proves the wiring in seconds. Swap in a larger model by adding another entry under model_list with the same shape. LiteLLM runs here without a database, which is fine for a single gateway key. Virtual keys and per-user budgets need its PostgreSQL backend, so add that before you hand out keys per team.
Open the SearXNG JSON API
This is the setting most LibreChat SearXNG guides miss. SearXNG’s default settings allow only the html format, and LibreChat asks for format=json, so a stock instance answers LibreChat with 403 Forbidden. Create the settings file before the first start:
vim searxng/settings.yml
Keep the upstream defaults with use_default_settings and add json to the formats. The limiter is off because the only client is LibreChat on the same private network:
use_default_settings: true
server:
secret_key: "replace-with-random-hex"
limiter: false
image_proxy: false
search:
safe_search: 1
formats:
- html
- json
Replace the placeholder secret with a random value now. On its first start the SearXNG container takes ownership of this directory as its own user (UID 977), so after that you’ll need sudo to edit the file:
sed -i "s/replace-with-random-hex/$(openssl rand -hex 32)/" searxng/settings.yml
The SearXNG search settings reference lists the other formats (csv and rss). LibreChat only needs JSON.
Wire LiteLLM and web search into librechat.yaml
Now for LibreChat itself. librechat.yaml does two jobs here. It registers LiteLLM as a custom OpenAI-compatible endpoint, and it turns on web search with SearXNG as the provider and Firecrawl as the scraper. Create it in the project root:
vim librechat.yaml
This is the file that ran. The ${...} references are read from .env by LibreChat, not by your shell:
version: 1.3.17
cache: true
endpoints:
custom:
- name: "LiteLLM"
apiKey: "${LITELLM_MASTER_KEY}"
baseURL: "http://litellm:4000/v1"
models:
default: ["qwen2.5-0.5b"]
fetch: true
titleConvo: true
titleModel: "qwen2.5-0.5b"
modelDisplayLabel: "LiteLLM"
webSearch:
searchProvider: "searxng"
searxngInstanceUrl: "${SEARXNG_INSTANCE_URL}"
scraperProvider: "firecrawl"
firecrawlApiKey: "${FIRECRAWL_API_KEY}"
firecrawlApiUrl: "${FIRECRAWL_API_URL}"
rerankerType: "none"
allowedAddresses:
- "searxng:8080"
- "firecrawl:3002"
Three lines in that file carry the integration, and each one answers a question we had going in:
- Is a scraper required? Yes. With
scraperProviderunset, LibreChat opens a “Web Search” dialog that asks each user for a Firecrawl API key and URL before any search runs. The scraper choices are Firecrawl, Serper, Tavily and Keenable. Self-hosting Firecrawl keeps the whole search path private. - Is a reranker required? No.
rerankerType: "none"worked, and search answers came back without a Jina or Cohere key. - Why
allowedAddresses? LibreChat blocks web search connections to private, loopback and link-local addresses as SSRF protection. Docker service names resolve to private172.xaddresses, so each self-hosted provider must be listed ashost:portwith no scheme.
Set version to the current config schema version. With an older value such as 1.3.0, LibreChat logs Outdated Config version: 1.3.0 along with the latest version it supports. The LibreChat web search configuration reference documents every key above, including the URL formats.
Bring up the LibreChat Docker Compose stack
The Compose file runs eleven containers. Six are the chat stack (LibreChat, MongoDB, Meilisearch, LiteLLM, Ollama, SearXNG), and five are the self-hosted Firecrawl (API, Playwright, Redis, RabbitMQ, PostgreSQL). Create it:
vim docker-compose.yml
Paste the file below. The pinned image tags are the ones we tested together, and the release pages for each are linked after the block. Firecrawl’s Playwright and PostgreSQL images only publish latest, and Redis and RabbitMQ follow their major version, so those four can move under you on a fresh pull. LibreChat is published on 127.0.0.1 only, because nginx will front it, and LiteLLM is published on loopback so you can test it from the host:
services:
librechat:
image: ghcr.io/librechat-ai/librechat:v0.8.8
container_name: librechat
user: "${UID}:${GID}"
restart: unless-stopped
ports:
- "127.0.0.1:3080:3080"
depends_on:
- mongodb
- meilisearch
- litellm
- searxng
- firecrawl
env_file: .env
environment:
- HOST=0.0.0.0
- MONGO_URI=mongodb://mongodb:27017/LibreChat
- MEILI_HOST=http://meilisearch:7700
volumes:
- ./librechat.yaml:/app/librechat.yaml:ro
- ./images:/app/client/public/images
- ./uploads:/app/uploads
- ./logs:/app/logs
mongodb:
image: mongo:8.0.20
container_name: chat-mongodb
restart: unless-stopped
command: mongod --noauth
volumes:
- ./data-node:/data/db
meilisearch:
image: getmeili/meilisearch:v1.35.1
container_name: chat-meilisearch
restart: unless-stopped
environment:
- MEILI_HOST=http://meilisearch:7700
- MEILI_NO_ANALYTICS=true
- MEILI_MASTER_KEY=${MEILI_MASTER_KEY}
volumes:
- ./meili_data:/meili_data
litellm:
image: ghcr.io/berriai/litellm:v1.109.1
container_name: litellm
restart: unless-stopped
command: ["--config", "/app/config.yaml", "--port", "4000"]
ports:
- "127.0.0.1:4000:4000"
environment:
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY}
volumes:
- ./litellm/config.yaml:/app/config.yaml:ro
depends_on:
- ollama
ollama:
image: ollama/ollama:0.40.16
container_name: ollama
restart: unless-stopped
volumes:
- ./ollama:/root/.ollama
searxng:
image: searxng/searxng:2026.11.12-de722ab1b
container_name: searxng
restart: unless-stopped
volumes:
- ./searxng:/etc/searxng
firecrawl:
image: ghcr.io/firecrawl/firecrawl:2.11.209
container_name: firecrawl
restart: unless-stopped
command: node dist/src/harness.js --start-docker
ulimits:
nofile:
soft: 65535
hard: 65535
environment:
HOST: "0.0.0.0"
PORT: 3002
ENV: local
USE_DB_AUTHENTICATION: "false"
REDIS_URL: redis://firecrawl-redis:6379
REDIS_RATE_LIMIT_URL: redis://firecrawl-redis:6379
PLAYWRIGHT_MICROSERVICE_URL: http://firecrawl-playwright:3000/scrape
NUQ_RABBITMQ_URL: amqp://firecrawl-rabbitmq:5672
POSTGRES_HOST: firecrawl-postgres
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${FIRECRAWL_PG_PASSWORD}
POSTGRES_DB: postgres
NUM_WORKERS_PER_QUEUE: 2
MAX_CONCURRENT_JOBS: 2
BROWSER_POOL_SIZE: 2
depends_on:
firecrawl-redis:
condition: service_started
firecrawl-playwright:
condition: service_started
firecrawl-rabbitmq:
condition: service_healthy
firecrawl-postgres:
condition: service_healthy
firecrawl-playwright:
image: ghcr.io/firecrawl/playwright-service:latest
container_name: firecrawl-playwright
restart: unless-stopped
environment:
PORT: 3000
MAX_CONCURRENT_PAGES: 2
mem_limit: 2g
tmpfs:
- /tmp/.cache:noexec,nosuid,size=1g
firecrawl-redis:
image: redis:8-alpine
container_name: firecrawl-redis
restart: unless-stopped
command: redis-server --bind 0.0.0.0
firecrawl-rabbitmq:
image: rabbitmq:4-management
container_name: firecrawl-rabbitmq
restart: unless-stopped
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "check_running"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
firecrawl-postgres:
image: ghcr.io/firecrawl/nuq-postgres:latest
container_name: firecrawl-postgres
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${FIRECRAWL_PG_PASSWORD}
POSTGRES_DB: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 5s
timeout: 5s
retries: 10
Before you bump any tag, check its release page: LibreChat, LiteLLM, Ollama and Firecrawl. LibreChat’s images now publish under ghcr.io/librechat-ai. The older ghcr.io/danny-avila path stopped at a release candidate, so a Compose file copied from an older guide pulls a stale build. LiteLLM’s plain vX.Y.Z tags are the ones to pin. Start the stack:
docker compose up -d
docker compose ps --format "table {{.Name}}\t{{.Image}}\t{{.Status}}"
All eleven containers should show Up, and the two with health checks, firecrawl-postgres and firecrawl-rabbitmq, should read (healthy). Firecrawl waits on both, so it’s normally the last to start:

Then check that LibreChat read its config. Run docker compose logs librechat and look for these lines:
info: Custom config file loaded:
warn: RAG API is either not running or not reachable at undefined, you may experience errors with file uploads.
info: Server listening on all interfaces at port 3080. Use http://localhost:3080 to access it
info: [schedules] engine started
The RAG API warning is expected. This stack doesn’t run LibreChat’s separate RAG service, so file chat is off, while chat and web search are unaffected. If you see EACCES or Outdated Config version instead, jump to the troubleshooting section.
Pull a model and test the LiteLLM route
Ollama starts empty, so pull the model that LiteLLM’s config names. It’s a 397 MB download:
docker compose exec ollama ollama pull qwen2.5:0.5b
docker compose exec ollama ollama list
The list should show the tag LiteLLM points at:
NAME ID SIZE MODIFIED
qwen2.5:0.5b a8b0c5157701 397 MB 17 minutes ago
Now test LiteLLM from the host before LibreChat gets involved. If this fails, LibreChat will fail too, and the LiteLLM logs are easier to read than LibreChat’s. Pull the master key out of .env without sourcing it:
export LITELLM_MASTER_KEY=$(grep ^LITELLM_MASTER_KEY .env | cut -d= -f2)
curl -s http://127.0.0.1:4000/v1/models -H "Authorization: Bearer ${LITELLM_MASTER_KEY}"
LiteLLM lists the public model name from its config. That is the exact string LibreChat must use in librechat.yaml:
{"data":[{"id":"qwen2.5-0.5b","object":"model","created":1677610602,"owned_by":"openai"}],"object":"list"}
Send one chat completion through the same route. It goes from LiteLLM to Ollama and back, which proves the model link end to end:
curl -s http://127.0.0.1:4000/v1/chat/completions \
-H "Authorization: Bearer ${LITELLM_MASTER_KEY}" \
-H "Content-Type: application/json" \
-d '{"model": "qwen2.5-0.5b", "messages": [{"role": "user", "content": "In one sentence, what does SearXNG do?"}]}' | python3 -m json.tool
The reply came back in a few seconds on CPU:
{
"id": "chatcmpl-cac6930a-71b7-44d9-a091-830172690ecd",
"created": 1794478061,
"model": "qwen2.5-0.5b",
"object": "chat.completion",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "SearXNG is a platform that helps businesses and individuals find and access high-quality, up-to-date news and information, improving their understanding and decision-making processes.",
"role": "assistant"
}
}
],
"usage": {
"completion_tokens": 34,
"prompt_tokens": 41,
"total_tokens": 75
}
}
Read that answer closely, because it’s wrong. SearXNG is a privacy-respecting metasearch engine, not a news platform. A half-billion-parameter model makes things up with confidence when it has nothing to ground it, which is the strongest argument for the web search link this guide builds. The capture below shows the model loaded entirely on CPU next to the LiteLLM model list:

The 100% CPU column in ollama ps confirms no GPU was involved. On a GPU host you’d see the same output with the processor column reading GPU instead, and nothing else in the stack changes.
Check SearXNG and Firecrawl from inside LibreChat
The search link should be tested from where LibreChat sits, not from the host. SearXNG and Firecrawl publish no ports, and what matters is whether the LibreChat container can reach them by service name. The LibreChat image ships Node, so fetch works as a client:
docker compose exec librechat node -e "fetch('http://searxng:8080/search?q=ollama+release&format=json').then(r => r.json()).then(j => console.log('results:', j.results.length, 'first:', j.results[0].url, 'unresponsive:', JSON.stringify(j.unresponsive_engines)))"
A working instance returns a few dozen results. If it doesn’t, the most likely cause is the missing json format, which shows up as a JSON parse error here:
results: 38 first: https://github.com/ollama/ollama/releases unresponsive: [["duckduckgo","CAPTCHA"]]
The unresponsive field is worth a look. DuckDuckGo answered our cloud VM with a CAPTCHA on every run, and SearXNG suspends an engine for a day after a CAPTCHA by default. The other engines carried the query, so results were not affected. On a home connection DuckDuckGo usually answers. Next, scrape one page through Firecrawl:
docker compose exec librechat node -e "fetch('http://firecrawl:3002/v2/scrape', {method: 'POST', headers: {'Content-Type': 'application/json', 'Authorization': 'Bearer ' + process.env.FIRECRAWL_API_KEY}, body: JSON.stringify({url: 'https://example.com', formats: ['markdown']})}).then(r => r.json()).then(j => console.log('success:', j.success, 'title:', j.data.metadata.title))"
Firecrawl rendered the page in its Playwright browser and returned the title:
success: true title: Example Domain
Now LibreChat can reach the search engine, the scraper and the model, which covers every hop in the diagram except the browser. Run these checks one at a time at the prompt. In a script, docker compose exec reads the script’s own stdin, and our scripted run of the Firecrawl check printed nothing until we ran it on its own.
Put nginx and HTTPS in front of LibreChat
LibreChat handles logins and API keys, so it should not be reached over plain HTTP. Since it listens only on 127.0.0.1:3080, nginx becomes the single public entry point. Install nginx and certbot:
sudo apt install -y nginx certbot python3-certbot-nginx
Create a server block for LibreChat:
sudo vim /etc/nginx/sites-available/librechat.conf
Use your own hostname in server_name. proxy_buffering off matters here because LibreChat streams replies token by token, and with buffering on, nginx holds the whole answer back until it’s finished:
server {
listen 80;
server_name chat.example.com;
client_max_body_size 25M;
location / {
proxy_pass http://127.0.0.1:3080;
proxy_http_version 1.1;
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;
proxy_buffering off;
proxy_read_timeout 300s;
}
}
Enable the site, check the syntax and reload. The curl at the end goes through nginx with your hostname and should print 200:
sudo ln -s /etc/nginx/sites-available/librechat.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
curl -s -o /dev/null -w "%{http_code}\n" -H "Host: ${DOMAIN}" http://127.0.0.1/
The proxy answered for the LibreChat app:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
200
If UFW is active, open HTTP and HTTPS, then request the certificate. Certbot’s nginx plugin proves the domain over port 80, adds the listen 443 ssl block to this file and sets up the HTTP to HTTPS redirect:
sudo ufw allow "Nginx Full"
sudo certbot --nginx -d "${DOMAIN}" --non-interactive --agree-tos --redirect -m "${EMAIL}"
sudo certbot renew --dry-run
One honest note on our lab: the cloud project the stack ran in did not allow inbound port 80, so the nginx proxy was tested with the curl above while the certificate request was not run. If certbot fails with a timeout or an unauthorized error, the challenge didn’t reach the server: check that the A record resolves to this host (dig +short chat.example.com) and that port 80 is open in your cloud firewall as well as UFW. Once the certificate is in place, port 443 must be open too, which the Nginx Full rule covers.
Alternative: DNS-01 when port 80 is closed
A LibreChat that only lives on a private network or behind a VPN can’t answer an HTTP-01 challenge. DNS-01 proves the domain with a TXT record instead, so the server never needs inbound port 80. Install the plugin for your DNS provider:
| DNS provider | Package | Certbot flag |
|---|---|---|
| Cloudflare | python3-certbot-dns-cloudflare | --dns-cloudflare |
| AWS Route 53 | python3-certbot-dns-route53 | --dns-route53 |
| DigitalOcean | python3-certbot-dns-digitalocean | --dns-digitalocean |
| Google Cloud DNS | python3-certbot-dns-google | --dns-google |
| Linode | python3-certbot-dns-linode | --dns-linode |
| OVH | python3-certbot-dns-ovh | --dns-ovh |
| BIND or any RFC 2136 server | python3-certbot-dns-rfc2136 | --dns-rfc2136 |
With Cloudflare as the example, save an API token that has Zone DNS Edit rights in a credentials file:
sudo apt install -y python3-certbot-dns-cloudflare
sudo mkdir -p /etc/letsencrypt
sudo vim /etc/letsencrypt/cloudflare.ini
The file holds one line with the token:
dns_cloudflare_api_token = your-cloudflare-api-token
Lock the file down, request the certificate, then let the nginx plugin install it into the server block:
sudo chmod 600 /etc/letsencrypt/cloudflare.ini
sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini -d "${DOMAIN}" --non-interactive --agree-tos -m "${EMAIL}"
sudo certbot install --nginx --cert-name "${DOMAIN}" --redirect
If DNS-01 fails with Incorrect TXT record or a propagation timeout, the token usually lacks edit rights on that zone, or the domain’s nameservers aren’t the provider you configured. Check with dig +short NS example.com, then raise --dns-cloudflare-propagation-seconds to 60 for slow providers. Renewal works the same way as with HTTP-01, and sudo certbot renew --dry-run tests it.
Create the admin account and close registration
Open https://chat.example.com and click Sign up. The first account registered on a LibreChat instance becomes its administrator, so do this before you share the URL:

Fill in a name, email and password, then click Continue. With registration still open, anyone who finds the hostname can create an account and burn your CPU. Close it and recreate the LibreChat container so it rereads .env:
sed -i 's/^ALLOW_REGISTRATION=true/ALLOW_REGISTRATION=false/' .env
docker compose up -d librechat
Give LibreChat about 15 seconds to start again; until then nginx answers 502 Bad Gateway, which we saw on our first check. Then look at both sides: the role stored in MongoDB, and what LibreChat’s own port now reports about sign-ups:
docker compose exec mongodb mongosh LibreChat --quiet --eval 'db.users.find({}, {email: 1, role: 1, _id: 0}).toArray()'
curl -s http://127.0.0.1:3080/api/config | grep -o '"registrationEnabled":[a-z]*'
Your account holds the ADMIN role and registration reports false. A new sign-up now gets Registration is not allowed. with HTTP 403:
[ { email: '[email protected]', role: 'ADMIN' } ]
"registrationEnabled":false
To add users later, flip the flag back for a minute, or use the create-user script described in the LibreChat authentication docs. Leaving registration open on a public hostname is the single most common way these instances get abused.
Run the first chat with live search
With both sides wired, the UI work is short. Pick the model that came through LiteLLM:
- Click the Model selector at the top left of the chat.
- Hover the LiteLLM endpoint, the name set by
modelDisplayLabelinlibrechat.yaml. - Choose the qwen2.5-0.5b model, which LibreChat fetched from LiteLLM’s
/v1/models.

- 1Model selector
- 2LiteLLM endpoint
- 3qwen2.5-0.5b model
If the LiteLLM endpoint is missing from that menu, LibreChat didn’t load the custom endpoint. Check the Custom config file loaded line in its logs and the indentation under endpoints.custom. Next, turn on search for the conversation:
- Click the Tools button (the sliders icon) on the message composer.
- Select Web Search. A Search chip appears on the composer while it’s on.

- 1Tools
- 2Web Search
We asked “Search the web: what is the latest Ollama release version?” because the model can’t know the answer from training data. LibreChat showed Searched the web with source icons, and the answer quoted the Ollama release notes it had scraped:

The pipeline worked and the answer was still subtly wrong. The model reported the newest Ollama build as the latest version, but on GitHub that build was marked as a pre-release, while the release marked Latest was the tag this stack pins. The search and scrape found the right page. The 0.5B model could not tell a pre-release from a stable release in the scraped text. The whole round trip took about 67 seconds on 4 vCPU, most of it the model reading the scraped pages. Both problems shrink with a 7B or larger model on a GPU. For anything you’d act on, click through the sources rather than trusting the summary.
Troubleshoot the search and model links
We hit these errors in this order while building the stack. The search errors are sneaky because the chat still answers: the model just replies without results and sometimes apologises for it.
Error: “SSRF protection: searxng resolved to blocked address 172.18.0.8”
With allowedAddresses missing from librechat.yaml, the UI shows “Searched the web” and the model gives a vague apology. Only the LibreChat log names the cause:
error: Error in search: SearXNG API request failed: SSRF protection: searxng resolved to blocked address 172.18.0.8
warn: [web_search] search=searxng queries=1 dur=17ms failed=1 reasons={web:other:1}
In the chat, the model only apologised and mentioned a blocked IP address:

Add the allowedAddresses list with searxng:8080 and firecrawl:3002, followed by docker compose restart librechat. List the scraper too. Allowing only SearXNG moves the same block one hop down the chain to Firecrawl.
Error: “SearXNG API request failed: Request failed with status code 403”
Once SSRF was allowed, the next search failed with a 403, because our first settings.yml listed only html under formats:
error: Error in search: SearXNG API request failed: Request failed with status code 403
warn: [web_search] search=searxng queries=1 dur=36ms failed=1 reasons={web:http_403:1}
In the chat, the model claimed it could not access the web at all:

Add json under search.formats and restart SearXNG. Since the container owns the directory by then, edit with sudo. A plain sed -i as your user fails with a permission error, and it’s easy to miss when it’s buried in a longer command:
sudo vim searxng/settings.yml
docker compose restart searxng
Rerun the node -e SearXNG check from earlier to confirm a result count instead of an error.
Error: “EACCES: permission denied, open ‘/app/logs/error-2026-11-12.log'”
LibreChat’s image runs as the node user, UID 1000. When your host user has a different UID (ours was 1001), it can’t write to the bind-mounted ./logs directory and crashes on start:
librechat | error: There was an uncaught error: EACCES: permission denied, open '/app/logs/error-2026-11-12.log'
The user: "${UID}:${GID}" line in the Compose file, with UID and GID written to .env, runs the container as your own user so the mounted folders match. Creating logs, images and uploads yourself before the first start matters for the same reason.
Firecrawl: “Can’t accept connection due to RAM/CPU load”
This one doesn’t show up in LibreChat at all. Searches find results, but the answers contain no page content, because every scrape sits in Firecrawl’s queue. docker compose logs firecrawl shows the worker refusing jobs:
firecrawl | worker Can't accept connection due to RAM/CPU load
On our 8 GB host, Firecrawl alone held 2.9 GiB and the machine had about 1.9 GB available, which was below the worker’s threshold. Moving to 16 GB cleared it. If you can’t add memory, lower NUM_WORKERS_PER_QUEUE and BROWSER_POOL_SIZE to 1, or use a hosted scraper key instead of self-hosting Firecrawl.
Pick LibreChat or Open WebUI for your stack
Both front ends sit happily on Ollama and LiteLLM, so the choice comes down to what you want around the chat box. After running this stack, this is where we would use each:
| You want | LibreChat | Open WebUI |
|---|---|---|
| One UI for many providers (OpenAI, Anthropic, local) side by side | Strong: custom endpoints in YAML | Works through OpenAI-compatible connections |
| Fastest single-container start | No: needs MongoDB and Meilisearch | Yes: one container plus Ollama |
| Web search with no paid API | SearXNG plus a scraper (Firecrawl here) | SearXNG on its own |
| Config in files you can commit | Yes: librechat.yaml and .env | Mostly in the admin UI |
| Lowest memory | About 5.8 GiB with self-hosted Firecrawl | Lower, no scraper stack |
We’d run LibreChat when a team needs several providers behind one login and wants the config in Git, and when private search is worth the extra containers. For a single user who wants local models running in ten minutes, Open WebUI is lighter: our guides to Open WebUI with Ollama on Docker Compose and Open WebUI on Ubuntu 26.04 cover that path. Whichever you pick, keep LiteLLM in the middle, so changing the front end later means pointing it at one endpoint rather than rewiring every model.