Self-host SearXNG
Metasearch engine that sends each query to many other search engines and merges the results without storing information about its users. Run your own SearXNG on an always-on EnvHaven workspace by asking its coding agent: one request installs it, puts it on an HTTPS address and locks it down. What the agent takes care of, and the manual route.
Updated November 23, 2026
Running your own SearXNG usually means a list of server chores: a machine that stays on, Docker or a runtime, a reverse proxy with certificates, a domain, and the settings that make SearXNG behave behind all of it. On an EnvHaven workspace you skip the list. You ask the coding agent, and it does the work while you watch.
Just ask your agent
Open a Plus workspace (SearXNG runs in Docker, which Plus and Pro include), tap Launch to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:
Set up SearXNG on this workspace and give me the link. Follow https://envhaven.com/self-host/searxng.md
Then open the link it sends and create your SearXNG account straight away, before anyone else finds the address. That is the whole request: the address in it is this page’s Markdown copy, and the agent follows the instructions for it further down, with every setting SearXNG’s docs require.
Or keep it private with Tailscale
The preview URL puts SearXNG on the public internet, which suits something other people need to reach. For an app only you and your household use, your tailnet is the better home: Tailscale gives SearXNG an HTTPS address that only your own devices, signed in to your Tailscale account, can open. Save a Tailscale auth key in the workspace’s Vars pane as TS_AUTHKEY, and ask the agent:
Set up SearXNG on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/searxng.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
- A Tailscale container runs beside SearXNG, so it keeps its private address through workspace restarts and updates, and every app you set up this way gets an address of its own.
- Anything other services have to reach, such as a webhook, still needs a public address. Keep self-hosted apps private with Tailscale covers both, and what Tailscale’s free plan includes.
| At a glance | |
|---|---|
| What it is | AI chat, models and agent tools |
| License | AGPL-3.0 |
| Runs as | Docker (docker.io/searxng/searxng) |
| Memory | Not documented |
| Plan that fits | Plus or larger |
| Web port | 8080 |
| Documentation | docs.searxng.org/admin/installation-docker.html |
What your agent takes care of
- Installing it. SearXNG runs from the official image,
docker.io/searxng/searxng, with its data in folders under~/apps/searxng. - Putting it on an HTTPS address. The workspace’s preview URL serves it, and your own domain can too.
- Locking it down first. What SearXNG’s docs say to set before it faces the internet, below.
- Telling you what to back up: /etc/searxng (settings.yml and other configuration; ./core-config/ in the compose file), /var/cache/searxng (persistent data such as faviconcache.db; named volume core-data) and valkey-data volume (limiter state) (docs).
The settings it needs behind a proxy
server.base_url($SEARXNG_BASE_URL): Public base URL of the instance, used for inbound links; the settings example shows a URL with a path. (docs)- Forwarded headers from the proxy: The reference nginx site sets X-Forwarded-Proto, X-Real-IP and X-Forwarded-For; the limiter reads the client address from them. (docs)
server.secret_key($SEARXNG_SECRET): Cryptographic key for the instance; the container replaces the placeholder with a random value when it creates settings.yml. (docs)server.limiter($SEARXNG_LIMITER) andserver.public_instance($SEARXNG_PUBLIC_INSTANCE): Rate limiting and bot blocking for instances open to the internet; the limiter needs Valkey, and public_instance switches on the link token and image proxy features. (docs)
Before it faces the internet
- Change the placeholder server.secret_key; the official container replaces it with a random value when it generates settings.yml. (docs)
- The docs recommend a reverse proxy when the instance is exposed to the public. (docs)
Things to ask next
Everything after the install is one more sentence to the agent. Some that come up:
- “Connect it to the API keys in my Vars pane, and make Claude the default model.”
- “Add a second user account for my partner, without admin rights.”
- “Move SearXNG to app.example.com.” Add the domain on the dashboard’s Domains page with a CNAME to
domains.envhaven.app, and the agent changes SearXNG’s address settings to match. - “Update SearXNG to the latest release.” It pulls the new image and recreates the container, data kept.
Instructions for the agent
The agent reads these from the page’s Markdown copy. They also work pasted on their own, if you would rather give them in your own words.
Set up SearXNG on this workspace and serve it at my preview URL.
- Use Docker Compose with the official image, docker.io/searxng/searxng, starting from the docs' compose file: https://github.com/searxng/searxng/blob/master/container/docker-compose.yml. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- The docs' setup includes: valkey (docker.io/valkey/valkey:9-alpine; the compose template starts it for the limiter, which needs a Valkey database).
- Keep the compose file in ~/apps/searxng and all of its data in folders there (bind mounts, not named volumes), with restart: unless-stopped on every service.
- This server has no firewall, so publish no port on its public IP, and drop host networking and privileged mode from the docs' compose file. Docker runs on the host: connect this workspace to the compose network and relay my preview URL's port to SearXNG's port 8080.
- The preview URL terminates HTTPS in front of SearXNG: serve plain HTTP on its port, and trust the forwarded headers the relay passes on.
- Set what "The settings it needs behind a proxy" lists on https://envhaven.com/self-host/searxng.md for the preview URL, as SearXNG's docs describe for running behind a proxy; skip any that apply only when SearXNG serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/searxng.md.
- When it answers at the preview URL, send me the link and tell me what to back up.
- If I asked for my tailnet instead of the preview URL, set SearXNG up the same way but follow https://envhaven.com/guides/self-host-privately-with-tailscale.md for the network: no preview URL, no relay.
What to know
- In Docker, SearXNG’s containers keep running when the workspace restarts or updates. The relay from the preview URL is a process in the workspace, so after a restart or an update, ask the agent to restore it.
- Search engines can block or CAPTCHA the IP address of a server; the docs describe solving the CAPTCHA through an SSH SOCKS tunnel from the server’s IP. (docs)
- Only the html result format is enabled by default, so tools that call the JSON API (format=json) need json added under search.formats in settings.yml. (docs)
- The compose template publishes the port on all interfaces unless SEARXNG_HOST sets a listen address, so bind it to loopback when a proxy or tunnel runs on the same host. (docs)
- The image proxy uses memory, and the container settings template turns it on. (docs)
- A workspace has one preview URL and one custom domain, both serving the same port, so it puts one app on a public address at a time.
Without a workspace
The manual route, on a server you run:
- Rent a Linux VPS, secure SSH, and create a user for the app.
- Install Docker and write a compose file from the official image.
- Put a reverse proxy in front (Caddy, nginx or Traefik), get certificates, and point a domain at the server.
- Set the proxy settings listed above for that domain, and pass WebSocket upgrades through the proxy if the app uses them.
- Keep the firewall closed except for the proxy, and schedule backups and updates.
SearXNG’s own documentation covers each step for its install methods.
Sources
Facts about SearXNG come from its own documentation, checked on 2026-11-23:
- docs.searxng.org/admin/installation-docker.html
- docs.searxng.org/admin/searx.limiter.html
- docs.searxng.org/admin/settings/settings_server.html
- github.com/searxng/searxng/blob/master/utils/templates/etc/nginx/default.apps-available/searxng.conf
- docs.searxng.org/admin/installation-nginx.html
- docs.searxng.org/admin/answer-captcha.html
- github.com/searxng/searxng/blob/master/searx/settings.yml
- github.com/searxng/searxng/blob/master/container/.env.example