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 tofalsefor a private homelab. Iftrue, the limiter is forced on, requiring alimiter.tomlfile to prevent blocking legitimate traffic.method: Set to"GET"to allow sharing search URLs and using browser back/forward navigation.valkey: Configured to use thesearxng-valkeycontainer 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
- Navigate to
chrome://settings/searchEngines. - Under Site search, click Add.
- Set Search engine to
Homelab Search, Shortcut tos, and URL tohttps://search.dehott.link/search?q=%s. - Make it the default.
Firefox
- Visit
https://search.dehott.link. - Right-click the address bar and select Add "Homelab Search".
- Go to
about:preferences#searchand 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
Arecord points to the correct public IP. If searches take too long (10+ seconds), reduce the number of active engines or default categories insettings.yml. - Cannot Access Site (403 Forbidden): If
public_instanceistrue, ensure/home/tim/homelab/data/searxng/limiter.tomlexists and is configured correctly, or setpublic_instancetofalse.