Deploy SearXNG

Private SearXNG behind a password, with engines that answer from Railway

Deploy SearXNG

Deploy and Host SearXNG on Railway

SearXNG is a metasearch engine: it sends your query to Google, Bing, Yahoo and others and shows the results without ads, tracking or a profile of you. It also has a JSON API, which many AI tools use for web search.

This template runs SearXNG on Railway's private network with a password prompt in front of it.

About Hosting SearXNG

An open SearXNG on a public URL gets found and used as a free search proxy by bots, which costs you bandwidth and gets your instance blocked by the search engines. Here a small Caddy service asks for SEARXNG_USERNAME and SEARXNG_PASSWORD (generated) before anything reaches SearXNG. Only /healthz is open, for Railway's healthcheck.

Search engines treat Railway's datacenter IPs differently, and SearXNG's defaults don't hold up there. I tested each engine from a deployment: DuckDuckGo answered with a CAPTCHA, and Brave, Startpage, Qwant and Mojeek returned nothing. Google and Bing work, but they're not in SearXNG's default selection, so my first build only searched Yahoo and returned 7 results a query. With Google, Bing and Yahoo turned on it returned 16 to 25 results for the same queries. The settings keep those three, their news engines, Wikipedia and a few developer sources (GitHub, Stack Overflow, PyPI, npm, MDN, arXiv).

The JSON API is on (format=json), so you can point Open WebUI, Perplexica/Vane, n8n or your own scripts at it with the same username and password.

Before publishing I tested it on Railway. /healthz answered without a password, the search page without a password or with a wrong one got 401, and with the password the page loaded and JSON searches returned results from Google, Bing and Yahoo with no failing engines. After restarting both services the same checks passed.

Common Use Cases

  • A private search engine for your own browser, with no tracking and no ads
  • Web search for AI tools and agents through the JSON API, without a paid search API
  • One search endpoint shared by several services in a Railway project

Dependencies for SearXNG Hosting

Nothing beyond the template. Tools need to send the username and password: most accept them in the URL (https://user:password@your-domain/search?q=...&format=json) or as a Basic auth header.

Deployment Dependencies

Implementation Details

SEARXNG_URL                            # open this in your browser
SEARXNG_USERNAME / SEARXNG_PASSWORD    # the password prompt (password generated)
curl -u "$SEARXNG_USERNAME:$SEARXNG_PASSWORD" "$SEARXNG_URL/search?q=railway&format=json"

Idle, SearXNG used 0.10 GB of RAM and the gate 0.04 GB, about $1.50 a month on Railway's usage pricing.

Why Deploy SearXNG on Railway?

You get your own search engine on HTTPS in one deploy, with engines that answer from Railway's network and a password so it stays yours. The tradeoff is that results depend on search engines that accept datacenter traffic, which can change; when one stops answering, SearXNG suspends it and uses the others.


Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
47
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51