Tutorial

How to Self-Host SearXNG and When to Pay Instead

r/searchengines and r/Searx posts shipped self-hosted SearXNG aggregators. Walk-through to deploy plus the operational-cost reality.

Two recent Reddit posts shipped self-hosted SearXNG variants as free SerpAPI alternatives. This walks the deployment plus the operational reality that decides when to pay for hosted instead.

Prerequisites

  • A small VPS or Railway/Render account
  • Docker basics
  • Awareness that you own captcha/Cloudflare handling

Walkthrough

Step 1: Deploy SearXNG via Docker

Official image, settings.yml with JSON output enabled.

Bash
docker run -d --name searxng -p 8888:8080 \
  -v $(pwd)/searxng:/etc/searxng \
  -e BASE_URL=http://localhost:8888 \
  -e INSTANCE_NAME=my-searxng \
  searxng/searxng:latest

Step 2: Enable JSON output in settings.yml

By default, JSON is off on public instances.

# /etc/searxng/settings.yml
search:
  formats:
    - html
    - json

Step 3: Hit /search with format=json

Standard SearXNG API shape.

Bash
curl 'http://localhost:8888/search?q=ai+agents+2026&format=json' | jq .results[0]

Step 4: Add a Redis rate-limit layer

SearXNG rate-limits per IP via Redis.

Bash
docker run -d --name searxng-redis -p 6379:6379 redis:alpine
# Update settings.yml: redis.url: redis://searxng-redis:6379

Step 5: Decide: keep self-hosted or pay

Decision rule based on volume and uptime.

Text
# Stay self-hosted when:
# - <500 queries/day and intermittent failure is OK
# - Privacy / no-vendor is a hard requirement
# - You enjoy operating things
# Pay $30/mo Scavio when:
# - Production agents on cron need stable uptime
# - You hit Cloudflare/captcha walls weekly
# - Ops time costs more than $30/mo

Python Example

Python
import requests
result = requests.get('http://localhost:8888/search', params={'q': 'ai agents', 'format': 'json'}).json()

JavaScript Example

JavaScript
const result = await fetch('http://localhost:8888/search?q=ai+agents&format=json').then(r => r.json());

Expected Output

JSON
Self-hosted SearXNG returning JSON. Works for personal-research load. Production agents on cron will eventually hit captcha/IP issues; that is when paid hosted alternatives earn their fee.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

A small VPS or Railway/Render account. Docker basics. Awareness that you own captcha/Cloudflare handling. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

r/searchengines and r/Searx posts shipped self-hosted SearXNG aggregators. Walk-through to deploy plus the operational-cost reality.