Search is the most surveilled thing most people do online. Every query you type reveals health worries, financial stress, relationship problems and political opinions — and it is stored, profiled and monetised. Google’s results are also increasingly shaped by ads, AI summaries and SEO games rather than by what you asked for.

SearXNG fixes both problems at once. It is an open-source metasearch engine: it forwards your query to dozens of upstream engines, merges and ranks the results, and returns them to you. No account, no tracking cookie, no ads, no query log by default. And because it is a metasearch engine rather than its own index, you get Google-quality coverage without building a crawler.

This guide covers a proper Docker deployment, engine tuning, the JSON API that makes it useful for scripts and LLM agents, and the security settings that keep it from being abused.

What SearXNG does differently

A normal search engine owns its index and knows who you are. SearXNG owns nothing: it queries other engines on your behalf, from your server’s IP, and passes the results through.

Three properties follow from that design:

  • Query privacy. Your ISP and the upstream engines see your server, not you. With a VPN or a rented VPS, they do not even see your home IP.
  • No filter bubble. Results are not personalised because there is no profile to personalise against. Two people asking the same thing get the same answer.
  • Aggregation. One query can pull from Google, Bing, Brave, DuckDuckGo, Wikipedia, and specialised engines for code, science and torrents, then deduplicate the overlap.

The trade-off is honest: upstream engines can rate-limit or block your server IP, and if your instance is public and busy, they will. That is why the settings below matter.

Prerequisites

  • Docker and Docker Compose v2 — see Docker basics for the homelab if this is your first container.
  • 512 MB RAM is plenty. SearXNG is a Python app that proxies requests; it does no indexing and needs no storage.
  • A reverse proxy for HTTPS if you want it reachable by domain — Caddy in two lines.
  • Optional: Tailscale if it is only for you and your devices.

Step 1: Docker Compose deployment

Create a directory and two files. First docker-compose.yml:

services:
  searxng:
    image: docker.io/searxng/searxng:latest
    container_name: searxng
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./searxng:/etc/searxng:rw
    environment:
      - SEARXNG_BASE_URL=https://search.example.com/
      - SEARXNG_SECRET=change-me-to-a-long-random-string
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
    logging:
      driver: json-file
      options:
        max-size: "1m"
        max-file: "1"
    restart: unless-stopped

Notes that prevent real problems later:

  • 127.0.0.1:8080 keeps the port off the network entirely — everything goes through your reverse proxy.
  • cap_drop: ALL plus three specific capabilities is the documented hardening; SearXNG does not need more.
  • max-size: 1m stops the log file from quietly eating your disk, which it will over months.
  • Generate SEARXNG_SECRET with openssl rand -hex 32. It signs internal tokens; a weak one is a real vulnerability.

Then create searxng/settings.yml:

use_default_settings: true

general:
  instance_name: "Private Search"

server:
  secret_key: "change-me-to-a-long-random-string"
  limiter: true
  image_proxy: true
  method: "POST"

search:
  safe_search: 0
  autocomplete: ""
  formats:
    - html
    - json

ui:
  default_locale: "en"
  infinite_scroll: true

Start it:

mkdir -p searxng
docker compose up -d
docker compose logs -f searxng

Now open http://127.0.0.1:8080. If you see the search page, the hard part is already done.

Step 2: Tune the engines

Out of the box SearXNG enables a very large engine list, and some of them will fail and slow every search down. Edit settings.yml and be deliberate:

engines:
  - name: google
    engine: google
    shortcut: go
    disabled: false
  - name: duckduckgo
    engine: duckduckgo
    shortcut: ddg
    disabled: false
  - name: brave
    engine: brave
    shortcut: br
    disabled: false
  - name: wikipedia
    engine: wikipedia
    shortcut: wp
    disabled: false
  - name: github
    engine: github
    shortcut: gh
    disabled: false

Sensible guidance after running a few instances:

  1. Keep four to six general engines. More means slower responses and more chances of a block.
  2. Leave the ones that break disabled. A failing engine shows an error banner and adds latency to every query.
  3. Use shortcuts. Typing !gh astro searches GitHub only; !wp caddy goes straight to Wikipedia. It is the fastest feature to adopt.

Step 3: The JSON API — where this gets genuinely useful

Enable the json format (already in the config above) and you have a free, unlimited search API for scripts, dashboards and AI agents:

curl -s "http://127.0.0.1:8080/search?q=self+hosted+litellm&format=json" \
  | jq -r '.results[:5][] | "\(.title) — \(.url)"'

That is the piece that makes SearXNG more than a search page. Point an LLM agent at it and you get retrieval-augmented answers with live web results and no per-query cost — the local, private counterpart to paid search APIs. Combined with a local model via Ollama, you have a self-contained research loop.

If you run agents against it, keep the JSON endpoint internal. Do not expose format=json publicly — that is how instances get scraped into oblivion.

Step 4: Secure and expose it properly

The limiter: true setting above is essential if the instance is public. It throttles abusive request patterns so upstream engines do not blacklist your server.

Then a Caddy front:

search.example.com {
    basic_auth {
        admin $2a$14$replace_with_real_hash
    }
    reverse_proxy 127.0.0.1:8080
}

Generate the hash with caddy hash-password. For a personal instance, basic auth is the right level of effort: the search page itself is not sensitive, but an open proxy to Google on your server IP is exactly what scrapers hunt for.

Additional precautions worth taking:

  • Restrict egress if you can. On a VPS, a firewall rule allowing outbound only to 443 is fine and limits damage if something goes wrong.
  • Do not run a public instance for strangers. Public SearXNG instances attract heavy automated traffic and get your IP rate-limited by Google within weeks.
  • Read the homelab security rules once if you are exposing anything else on the same host.
  • Firefox: Settings → Search → Add: URL https://search.example.com/search?q=%s, set as default. Alternatively add it as a bookmark keyword: bookmark any URL with keyword s and query https://search.example.com/search?q=%s, then type s your query in the address bar.
  • Chrome/Chromium: Settings → Search engines → Site search → Add. Same URL pattern.
  • iOS Safari: add as a home-screen shortcut, or use a browser that supports custom engines.
  • Android: Firefox and Kiwi support custom engines; Chrome does not.

A week of using it is the real test. Results are good, occasionally different from Google, and the absence of ads and AI slop is immediately noticeable.

Common problems

“Engines failed” banner. Some upstream engines blocked your IP or changed their HTML. Disable the failing ones; this is normal maintenance, not a broken install.

Search is slow. Too many enabled engines. Cut to four or five and enable infinite_scroll.

Google returns nothing. Google aggressively blocks datacentre IPs. Run from a residential connection where possible, or rely on DuckDuckGo and Brave as primary.

Compose fails with permission errors on ./searxng. The container writes settings.yml; check ownership (chown 977:977 matches the in-image user) or mount a file instead of a directory.

Instance gets abused. limiter: true plus basic auth; also verify your reverse proxy is not forwarding X-Forwarded-For blindly.

For anyone who already runs a Pi-hole to block ads, SearXNG is the natural next step: Pi-hole stops tracking in requests leaving your network, SearXNG stops the tracking that happens in the one request you make deliberately. Both are tiny containers with near-zero maintenance.

The honest caveats: it needs occasional engine maintenance, results are slightly less polished than Google’s, and a public instance will be attacked by scrapers. For personal or family use on a box you control, it is one of the highest value-per-megabyte services in a homelab — and the JSON API turns it into infrastructure your other self-hosted tools can build on.