SearXNG is a free, open-source metasearch engine. It sends your query to many search engines (Google, Bing, DuckDuckGo, Brave, Wikipedia, GitHub and dozens more), merges the results, and returns them without tracking you or building a profile. Self-hosting it on a VPS gives you a private search engine for yourself, your family or your team, and a search backend for AI tools.

How it protects privacy

  • Search engines see the server’s IP, not yours, and no cookies tie your searches together.
  • SearXNG doesn’t log queries by default, and strips tracking parameters from results.
  • You choose which engines are used.

A single-user instance still sends your queries upstream from one IP, so it’s privacy from tracking and profiling, not anonymity.

Install with Docker Compose

The official searxng-docker repository bundles SearXNG, Valkey/Redis (for the rate limiter) and Caddy (HTTPS). If you already run Nginx, use just SearXNG and Redis:

# /opt/searxng/compose.yaml
services:
  redis:
    image: valkey/valkey:8-alpine
    restart: unless-stopped
    command: valkey-server --save "" --appendonly no
  searxng:
    image: searxng/searxng:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./searxng:/etc/searxng
    environment:
      SEARXNG_BASE_URL: https://search.example.com/
    depends_on: [redis]
cd /opt/searxng && docker compose up -d   # first start creates ./searxng/settings.yml

Configure settings.yml

Edit ./searxng/settings.yml:

use_default_settings: true
general:
  instance_name: "Example Search"
server:
  secret_key: "<openssl rand -hex 32>"     # must be changed
  limiter: true                             # bot protection for public instances
  image_proxy: true                         # proxy result images for privacy
redis:
  url: redis://redis:6379/0
search:
  safe_search: 0
  autocomplete: "duckduckgo"
  formats: [html, json]                     # json is needed for API use (e.g. AI tools)
ui:
  default_theme: simple

Restart: docker compose restart searxng.

Engines: enable or disable them under engines: in the settings, or per user in the Preferences page. Fewer, reliable engines mean faster, more consistent results.

HTTPS with Nginx

server {
    server_name search.example.com;
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
    }
    # listen 443 ssl; certbot --nginx -d search.example.com
}

The limiter needs the real client IP (X-Forwarded-For/X-Real-IP) to work. See real IP behind a proxy and Let’s Encrypt.

Set it as your browser’s default search engine. SearXNG supports OpenSearch, so browsers offer to add it.

Private vs public instance

  • Private (recommended): restrict access with basic auth or a VPN, or allow only your IPs. Upstream engines are less likely to rate-limit or block your server’s IP, because the query volume stays low. See Nginx basic auth.
  • Public: keep limiter: true and the bot detection, and expect higher load. Some engines (Google especially) may start returning CAPTCHAs or errors to your server’s IP. Rotate engines, and watch the logs.

Use it as an API (AI tools)

With json enabled in formats, tools like Open WebUI, LibreChat, Perplexica and agent frameworks can use SearXNG for web search:

https://search.example.com/search?q=<query>&format=json

Keep such instances private. See Open WebUI and LibreChat.

Troubleshooting

  • No results or errors from an engine: check the stats page (/stats). Upstream blocking or timeouts are common. Disable failing engines, or raise timeouts.
  • “Too many requests”: the limiter is blocking you. Check that the real IP is passed correctly, or whitelist your IP (limiter.toml).
  • Slow searches: reduce the number of enabled engines, and set request_timeout.

Updates

docker compose pull && docker compose up -d. SearXNG updates frequently to keep up with changes at search engines. See updating self-hosted apps.

Quick reference

Item Value
Port 8080 (behind Nginx)
Config settings.yml (secret_key, limiter, formats)
Engine stats /stats
JSON API /search?q=…&format=json
Rate limiter backend Redis / Valkey

Related: Pi-hole and DNS over HTTPS.

  • Self-Hosting
  • Privacy
  • Docker