---
title: "Private & Self-Hosted AI Web Search: Integrating SearXNG with Open WebUI for Local RAG"
date: "2026-09-30T10:00:00+02:00"
tags: ["SearXNG", "Open WebUI", "Docker", "RAG", "Privacy", "Self-Hosted"]
categories: ["AI & LLM Ops", "Homelab & Containers"]
---

![Private & Self-Hosted AI Web Search with SearXNG and Open WebUI][1]

Enabling real-time web browsing in local AI chat interfaces transforms large language models from static knowledge bases into dynamic research assistants. However, relying on default search providers like DuckDuckGo frequently breaks when running in containerized homelabs or cloud datacenters.

In this guide, I explain why datacenter search gets blocked and how to deploy a private **SearXNG** instance to provide reliable, rate-limit-free search grounding for **Open WebUI**.

<!--more-->

## The Problem with Datacenter Web Search

When Open WebUI queries search engines via DuckDuckGo:
- DuckDuckGo aggressively rate-limits or outright blacklists IP ranges belonging to hosting providers, VPSs, and residential VPN endpoints (e.g., Cloudflare tunnels or VPS proxies).
- The user sees generic `RAG search error: 403 Forbidden` or empty context cards.

---

## The Solution: Self-Hosted SearXNG Meta-Search Engine

**SearXNG** is a privacy-respecting, hackable metasearch engine that aggregates results from more than 70 search services (Google, Bing, Wikipedia, DuckDuckGo, Reddit, GitHub, etc.) while obfuscating client requests.

### 1. Docker Compose Deployment

```yaml
services:
  searxng:
    image: searxng/searxng:latest
    container_name: llm-searxng
    restart: unless-stopped
    environment:
      - SEARXNG_BASE_URL=http://llm-searxng:8080/
      - UWSGI_WORKERS=4
      - UWSGI_THREADS=4
    volumes:
      - /mnt/appdata/searxng:/etc/searxng
    networks:
      - frontend
```

> **Pro-Tip on Port Management:** Avoid exposing SearXNG directly on host ports like `8080:8080` without checking for port collisions (`ss -tulpn | grep 8080`). In our homelab architecture, we keep SearXNG inside the internal Docker `frontend` bridge network, accessible only to Open WebUI!

---

### 2. Configuring Open WebUI

In Open WebUI:
1. Navigate to **Admin Panel** &rarr; **Settings** &rarr; **Web Search**.
2. Set **Search Engine** to `searxng`.
3. Set **Searxng Query URL** to:
   ```text
   http://llm-searxng:8080/search?q=<query>
   ```
4. Configure RAG extraction:
   - **RAG Top K:** `5`
   - **RAG Template:** Include current timestamp and domain source citations.

Now, when you ask your model: *"What happened in tech today?"*, Open WebUI queries SearXNG across multiple search engines in parallel, extracts the raw HTML text, and feeds it directly into your model's context window!

[1]: /images/uploads/2026/09/private-ai-web-search-searxng-open-webui.webp

