The problem: why commercial search APIs are not the answer
Building an AI agent that needs to search the web? Your options are: pay Google $5 per 1,000 queries, hit Bing's API rate limits, or use DuckDuckGo's unofficial API that breaks without notice. None of these give you full control, and all of them send your queries — and your users' queries — to third-party servers.
For development teams in Morocco and the MENA region, there's an additional friction: regional blocks, censorship, and the fact that results from a US-centric engine are often irrelevant to local searches. A self-hosted metasearch engine sidesteps all of this.
What SearXNG provides out of the box
- 280+ upstream engines — Google, Bing, DuckDuckGo, Brave, Wikipedia, Reddit, GitHub, arXiv, YouTube, Twitter/X and hundreds more queried simultaneously.
- Zero tracking — no cookies, no user profiling, no search history stored. Privacy by architecture: the engine sends queries to upstream services, not you.
- JSON API — add
?format=jsonto any query and get machine-readable results. Natively supported by Open WebUI, n8n, Flowise, LangChain and CrewAI. - Redis caching — shared result cache reduces upstream load; rate-limiting prevents abuse on public instances.
- AGPL-3.0 — 33 k+ GitHub stars, rolling releases, Docker image updated weekly.
Architecture: two containers, under 512 MB RAM
SearXNG runs as two Docker containers: the Python engine itself (under 256 MB RAM) and a Redis instance (~30 MB) for caching and rate-limiting. No database, no persistent state beyond the Redis cache. On a 1 GB ServOrbit VPS, SearXNG leaves plenty of room for Nginx and the OS — a 2 GB VPS is comfortable for teams with multiple concurrent users or heavy AI agent traffic.
Self-hosting SearXNG on a VPS: step by step
Order a VPS
Choose a ServOrbit Cloud VPS with at least 1 GB RAM (Ubuntu 22.04). The provisioner handles Docker installation automatically.
Deploy from the marketplace
Select SearXNG in the marketplace. The provisioner starts two containers — the SearXNG engine and Redis — and generates a secret key displayed in your client area. The web interface is available immediately on port 8080.
Configure Nginx + SSL
Point your domain (e.g.
search.yourdomain.com) to the VPS IP in Cloudflare or your DNS provider. Then add an Nginx reverse-proxy block with SSL via Let's Encrypt: aserverlistening onlisten 443 ssl, aserver_name search.yourdomain.com, and insidelocation /aproxy_pass http://127.0.0.1:8080;together withproxy_set_header Host $host;.Update
SEARXNG_BASE_URL=https://search.yourdomain.com/and restart the container.Enable the JSON API for AI agents
Edit
/etc/searxng/settings.ymlon your VPS (mounted as a Docker volume). Under thesearch:key, extend theformats:list so it contains bothhtmlandjson.Restart the container with
docker compose restart searxng, then test the JSON output withcurl 'https://search.yourdomain.com/search?q=SearXNG&format=json' | jq '.results[0]'.Connect Open WebUI or n8n
In Open WebUI: Settings → Web Search → Provider: SearXNG → URL:
https://search.yourdomain.com. In n8n: HTTP Request node → GEThttps://search.yourdomain.com/search?format=json, passing your query in theqparameter. Your AI agents now have live, unfiltered, private web search.Logging in for the first time
There is no account and no password: open the URL and you can start searching straight away. Your preferences are stored in your browser, not in an account.
Restrict access on public instances
If your SearXNG instance is publicly reachable, add HTTP Basic Auth in Nginx or set limiter: true in settings.yml (Redis is required for the limiter). For AI-agent-only use, you can disable the HTML interface entirely and only expose the JSON endpoint — edit formats to remove html and restrict direct browser access.
SearXNG as the search backbone for your AI stack
SearXNG has become the de facto web search backend for self-hosted AI stacks in 2026. Open WebUI, n8n, Flowise, LangChain, CrewAI and most LLM orchestration frameworks have native SearXNG integration. The pattern is always the same: your LLM decides it needs current information, calls your SearXNG endpoint with a query, gets back a JSON array of results with titles, URLs and snippets, and uses those to ground its response.
This eliminates three pain points in one deployment: no per-query billing, no data leakage to Google or Bing, and no rate limit surprises at 2 AM when your agent is running a research batch.