DEV Community

Cover image for SearXNG: Self-Hosted Private Search with Docker in 15 Minutes
FlatlinerAtheist | CLI-NERDS
FlatlinerAtheist | CLI-NERDS

Posted on Originally published at clinerds.com

SearXNG: Self-Hosted Private Search with Docker in 15 Minutes

Every search you type into Google is logged, tied to your profile, and kept for years. The uncomfortable part is how specific searches get — medical symptoms at 2am, the divorce lawyer query, the salary research before a negotiation. SearXNG lets you keep using search engines without handing that diary to anyone: it's a free, open-source metasearch engine you run yourself, which fetches results from Google, Bing, Brave, DuckDuckGo and dozens more — while those engines only see your server, never you.

Here's how to run it with Docker in about fifteen minutes.

What SearXNG actually does

It is not a search engine with its own index. It's a privacy layer between you and the engines: your query goes to your server, your server queries the engines, results come back merged and cleaned — no tracking parameters, no ads, no personalized bubble. Two people searching the same thing see the same results.

The trade-off to know upfront: you are still using Google's index, just without the surveillance. If you want to leave Google entirely, SearXNG lets you disable it and rely on Brave, Mojeek, or DuckDuckGo instead.

The setup

You need Docker with Compose, and ideally a subdomain like search.example.com behind HTTPS if you'll use it outside your LAN. For a private instance on your home network, plain HTTP on the LAN is fine.

Create the folder and config:

mkdir -p searxng/searxng && cd searxng
Enter fullscreen mode Exit fullscreen mode

docker-compose.yml:

services:
  searxng:
    image: searxng/searxng:latest
    container_name: searxng
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./searxng:/etc/searxng:rw
    environment:
      - BASE_URL=https://search.example.com/
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
Enter fullscreen mode Exit fullscreen mode

searxng/settings.yml — the only required change is the secret key:

use_default_settings: true

server:
  secret_key: "CHANGE-THIS-TO-A-RANDOM-STRING"
  limiter: false

search:
  formats:
    - html
    - json
Enter fullscreen mode Exit fullscreen mode

Generate the key with openssl rand -hex 32 and paste it in. Then:

docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:8080 (or your server IP on the LAN) and search something. That's it — working metasearch, zero telemetry.

Two config notes worth understanding:

  • limiter: false is fine only for a private instance. If you expose SearXNG publicly, turn the limiter on and add the Valkey (Redis) container from the official docs — open instances get hammered by bots within hours.
  • formats: json is optional but handy — it lets you query your instance from scripts and other tools (/search?q=linux&format=json).

Make it your default search engine

The point of all this is to actually stop using google.com, so set it as default:

Firefox: Settings → Search → Add search engine, or visit your instance, right-click the address bar, and choose "Add SearXNG". The URL pattern is:

https://search.example.com/search?q=%s
Enter fullscreen mode Exit fullscreen mode

Brave/Chrome: Settings → Search engine → Manage search engines → Add. Same URL pattern, keyword sx, then set as default.

On your phone: same pattern in your browser's search settings. If you deGoogled your Android, this is the search app your setup was missing.

Tuning the engines

This is where SearXNG gets addictive. In Preferences → Engines you can toggle every source: Google, Bing, Brave, Wikipedia, Stack Overflow, GitHub, arXiv, even price trackers and image boards. Some setups that work well:

  • General privacy search: Brave + Mojeek + DuckDuckGo + Wikipedia, Google off
  • Dev work: add Stack Overflow, GitHub, and package registries; searches for error messages suddenly return answers instead of SEO spam
  • Research: enable arXiv, PubMed, and Semantic Scholar for an academic tab

You can also scope a single query without changing defaults — !github docker compose, !wikipedia torvalds, !duckduckgo news.

Keep it running

  • Updates: docker compose pull && docker compose up -d. SearXNG tracks engine changes closely, so updating monthly keeps result quality up.
  • Backups: your entire config is the searxng/ folder — settings.yml is really all that matters. Add it to your 3-2-1 backup routine.
  • If results stop coming: engines rate-limit servers that query them heavily. Check Stats in the UI; if Google is failing, weight Brave and Mojeek higher. This is normal and not something you broke.

Where this fits

Search was the last daily Google touchpoint for a lot of people — photos moved to Immich, files to Filux, passwords to Vaultwarden. With SearXNG as your default search, the remaining Google in your day is the stuff you choose, not the stuff that's watching by default.

Top comments (0)