Back to blog

Self-hosting your search upstream with SearXNG

Don't want queries leaving your network? SearXNG is a self-hosted metasearch engine aggregating 70+ engines with zero per-query cost. Here is how to wire it into WebSearch.

Sep 14, 2026WebSearch TeamWebSearch Team

Self-hosting your search upstream with SearXNG

WebSearch's search layer is pluggable: Brave, Serper, and Exa are hosted services — pay per query, zero setup. But there is one scenario none of them fit: queries that must not leave your network. Internal documents, compliance requirements, or simply avoiding per-query upstream fees.

That is where SearXNG comes in: a self-hosted metasearch engine aggregating results from 70+ engines like Google, Bing, and DuckDuckGo — with no API key of its own.

Deploy an instance

One line with Docker:

docker run -d -p 8888:8080 \
  -v ./searxng:/etc/searxng \
  searxng/searxng

The critical step is enabling JSON output — SearXNG renders HTML by default. Edit searxng/settings.yml:

search:
  formats:
    - html
    - json

Restart and verify:

curl 'http://localhost:8888/search?q=test&format=json'

JSON back means the instance is ready.

Wire it into WebSearch

In the admin panel, open the Search page and set three things:

  • Provider → SearXNG
  • SearXNG base URL → http://your-host:8888 (a private IP like http://10.x.x.x:8888 works fine)
  • SearXNG language → optional; zh-CN is sent as the language parameter

Save, then use the connectivity test on the same page to run a real query — you will see the provider, latency, and the first few results. Tests charge no credits and write no logs.

Trade-offs vs hosted APIs

SearXNGBrave / Serper / Exa
Upstream costNonePer query
OperationsYou run itZero ops
Data pathStays in your networkQueries go to a third party
Result qualityDepends on aggregated enginesIndependent index, stable
AvailabilitySingle point, yours to keepSLA-backed

In practice the two mix well: SearXNG as the default, a hosted API kept on file as backup — WebSearch falls back to any configured provider when the selected one is missing credentials, so switching is one dropdown in the admin panel.

Caveats

  • Reachability: the SearXNG URL is fetched server-side, so the machine running WebSearch must be able to reach it. A private instance is invisible to public deployments like Cloudflare Workers.
  • SSRF boundary: the SearXNG address is admin-configured trusted infrastructure and intentionally bypasses Extract's SSRF blocklist, which only guards user-submitted Extract URLs.
  • Rate limits: the engines SearXNG aggregates each have their own throttles; under high concurrency, tune SearXNG's limiter settings.