Skip to content

SearXNG Setup

SearXNG is a privacy-respecting, hackable metasearch engine. It aggregates results from more than 70 search services while avoiding tracking and profiling. In this homelab, it is configured as the default search provider for browsers, utilizing "bang" shortcuts for direct queries to specific engines.

Deployment

SearXNG is deployed via Docker Compose, typically alongside a Valkey (Redis fork) container for caching, which significantly improves response times for repeated searches.

Docker Compose Configuration

The stack is defined in /home/tim/homelab/docker-compose/personal/searxng.yml.

services:
  searxng:
    image: searxng/searxng:latest
    container_name: searxng
    restart: unless-stopped
    networks:
      - homelab-personal
    volumes:
      - /home/tim/homelab/data/searxng:/etc/searxng
    environment:
      - TZ=${TZ}
    depends_on:
      - searxng-valkey
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=homelab-personal"
      - "traefik.http.routers.searxng.rule=Host(`search.${DOMAIN}`)"
      - "traefik.http.routers.searxng.entrypoints=websecure"
      - "traefik.http.routers.searxng.tls=true"
      - "traefik.http.routers.searxng.tls.certresolver=letsencrypt"
      - "traefik.http.services.searxng.loadbalancer.server.port=8080"

  searxng-valkey:
    image: valkey/valkey:8-alpine
    container_name: searxng-valkey
    restart: unless-stopped
    networks:
      - homelab-personal
    command: valkey-server --save "" --appendonly no
    labels:
      - "traefik.enable=false"

networks:
  homelab-personal:
    external: true

Configuration (settings.yml)

The core configuration resides in /home/tim/homelab/data/searxng/settings.yml.

Key Settings

  • base_url: Must be set to the exact public URL (e.g., https://search.dehott.link). This is critical for OpenSearch integration, allowing browsers to add it as a search engine.
  • public_instance: Set to false for a private homelab. If true, the limiter is forced on, requiring a limiter.toml file to prevent blocking legitimate traffic.
  • method: Set to "GET" to allow sharing search URLs and using browser back/forward navigation.
  • valkey: Configured to use the searxng-valkey container for caching.

Example settings.yml

use_default_settings: true

server:
  base_url: "https://search.dehott.link"
  secret_key: "your_secret_key_here"
  public_instance: false
  image_proxy: true
  limiter: false
  method: "GET"

valkey:
  url: redis://searxng-valkey:6379/0

search:
  safe_search: 0
  autocomplete: "duckduckgo"
  default_lang: "en"
  default_categories:
    - general

ui:
  instance_name: "Homelab Search"
  infinite_scroll: true
  center_alignment: true
  results_on_new_tab: true

categories_as_tabs:
  general:
    name: General
    weight: 1
  it:
    name: IT
    weight: 2
  images:
    name: Images
    weight: 3

engines:
  - name: brave
    disabled: false
  - name: github
    disabled: false
  - name: stackoverflow
    disabled: false

Browser Integration

SearXNG can be set as the default search engine in Chrome or Firefox.

Chrome

  1. Navigate to chrome://settings/searchEngines.
  2. Under Site search, click Add.
  3. Set Search engine to Homelab Search, Shortcut to s, and URL to https://search.dehott.link/search?q=%s.
  4. Make it the default.

Firefox

  1. Visit https://search.dehott.link.
  2. Right-click the address bar and select Add "Homelab Search".
  3. Go to about:preferences#search and set it as the default.

Bang Shortcuts

When SearXNG is the default engine, you can use "bangs" directly in the address bar to query specific engines:

  • !gh docker compose -> Searches GitHub
  • !so python asyncio -> Searches Stack Overflow
  • !yt homelab tour -> Searches YouTube
  • !w reverse proxy -> Searches Wikipedia

Troubleshooting

  • Browser Timeouts (ERR_CONNECTION_TIMED_OUT): Ensure the Cloudflare DNS A record points to the correct public IP. If searches take too long (10+ seconds), reduce the number of active engines or default categories in settings.yml.
  • Cannot Access Site (403 Forbidden): If public_instance is true, ensure /home/tim/homelab/data/searxng/limiter.toml exists and is configured correctly, or set public_instance to false.