brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Guide: run your own search engine with SearXNG and make it the default on your iPhone and Mac

run your own search engine with SearXNG and make it the default on your iPhone and Mac

Guide searxng

11 steps 12 min read

I run my own search engine, because the big ones know too much about me. SearXNG is a metasearch engine: it takes your query, asks a pile of other engines, merges the answers and shows you one page without ads or trackers. I run it on my Unraid server and I like it more than I expected to. The awkward part is the last mile: making it the default on an iPhone, an Android phone and a Mac. Safari only offers Apple’s list, and on Android it depends on the browser. This guide covers the whole path: Docker Compose, a sane settings.yml, HTTPS over Tailscale, and what is and is not possible in Safari and on Android.

Time
12 min
Steps
11
Updated
19 Nov 2026

You will learn

  • Start SearXNG with Docker Compose
  • Edit settings.yml
  • Reach it over Tailscale with HTTPS
  • Check that it works
  • Make it the default on your iPhone

What you get and what you need

You end up with a private search page at an address like https://search.<tailnet>.ts.net that only your own devices can reach, a JSON API for scripts, and a search engine you can add to browsers that allow custom engines.

You need a Linux box or Unraid server with Docker and the Compose plugin, a Tailscale account with the Tailscale client on that server and on your devices, and about half an hour. The Compose file comes from the SearXNG container documentation, which uses the image docker.io/searxng/searxng and a Valkey container next to it. SearXNG is AGPL-3.0 software and releases are date-based tags, so pin one instead of riding latest. Menu labels on Apple and browser screens differ per version, so check them on your device.

The SearXNG start page with a search box, in the dark theme
Screenshot: the SearXNG start page (Benpiano800, CC BY 4.0, Wikimedia Commons)

Step 1 of 11: Start SearXNG with Docker Compose

The documentation’s recommended route is a Compose project with two services, core and valkey. Valkey is only needed for the bot limiter, but the file ships with it, so keep it.

mkdir -p ./searxng/core-config/
cd ./searxng/

curl -fsSL \
    -O https://raw.githubusercontent.com/searxng/searxng/master/container/docker-compose.yml \
    -O https://raw.githubusercontent.com/searxng/searxng/master/container/.env.example

cp -i .env.example .env
nano .env

In .env, set a version tag and make the port listen on localhost only. The Compose file publishes 0.0.0.0:8080 by default, and I do not want that on a LAN. The variables come from the project’s example file, which shows a date tag like 2026.3.25-541c6c3cb.

SEARXNG_VERSION=latest
SEARXNG_HOST=127.0.0.1
SEARXNG_PORT=8080

Replace latest with a real tag once it works. Then start it:

docker compose up -d
docker compose logs -f core

On first start the container sees that core-config/settings.yml does not exist, copies a template and replaces the placeholder secret with a random one. I read that in the project’s entrypoint script. Do not paste over it with an example that still says ultrasecretkey. On Unraid, keep the config folder in appdata; inside the container the paths are /etc/searxng and /var/cache/searxng.

Step 2 of 11: Edit settings.yml

Open core-config/settings.yml. The generated file starts with use_default_settings: true, which means your file only lists what differs from the built-in defaults. Keep the generated secret_key and add what follows.

use_default_settings: true

server:
  secret_key: "keep-the-generated-value"
  base_url: "https://search.<tailnet>.ts.net/"
  limiter: false
  image_proxy: true

valkey:
  url: valkey://valkey:6379/0

search:
  safe_search: 1
  autocomplete: "duckduckgo"
  default_lang: "nl-NL"
  formats:
    - html
    - json

ui:
  default_locale: "nl"

What each block does:

  • secret_key is used for cryptography. Treat it like a password; SEARXNG_SECRET overrides it.
  • base_url (or SEARXNG_BASE_URL) is the public address, used to build links. It matters for the OpenSearch file in step 4.
  • limiter is the bot protection and rate limiter, and it needs Valkey. On a tailnet-only instance I leave it off. If you expose the instance, turn it on and read the limiter page, especially trusted_proxies in limiter.toml, because behind a proxy the client address comes from forwarded headers.
  • safe_search takes 0 (none), 1 (moderate) or 2 (strict).
  • default_lang accepts codes from the project’s locale list, such as nl-NL. Leave it empty to detect the language from the browser, or type :nl in a query to switch for one search.
  • formats lists which output formats the web server offers. Only html is on in the sample; add json for the API. Asking for a format that is not listed returns a 403.

Engines: the defaults are fine to start with. To drop engines you do not want, use_default_settings can take a mapping with engines: remove: and a list of engine names, or keep_only: to switch everything else off. Take the names from the instance preferences. Restart after every change:

docker compose restart core

Step 3 of 11: Reach it over Tailscale with HTTPS

This is the step that decides whether your instance is private. Because the port is bound to localhost, nothing on the LAN can see it. Tailscale Serve then publishes it to your tailnet with a real HTTPS certificate. First enable HTTPS certificates once: in the admin console open the DNS page, make sure MagicDNS is on, and select Enable HTTPS under HTTPS Certificates. Tailscale warns that machine names and your tailnet name end up in public certificate transparency logs, so do not name a machine something sensitive.

tailscale serve --bg http://127.0.0.1:8080
tailscale serve status

--bg keeps it running across reboots. Serve defaults to HTTPS on port 443 and prints the address, shaped like https://<device-name>.<tailnet-name>.ts.net. Put exactly that address in base_url, then restart the container. To switch it off again, repeat the original flags with off:

tailscale serve --https=443 off

Access control rules still apply to Serve. On Unraid there is a second way: the per-container Tailscale setting in the Docker tab gives the container its own device name and a Serve option that uses its WebUI port. Unraid’s docs say it adds no authentication of its own, which is fine here. Do not enable Funnel; that publishes it to the whole internet.

Animation of one search: the device sends the query over Tailscale to SearXNG, which asks Google, Bing and DuckDuckGo and sends one merged page back

Step 4 of 11: Check that it works

From a device on the tailnet, not from the server itself:

curl -s "https://search.<tailnet>.ts.net/search?q=unraid&format=json" | head -c 300
curl -s https://search.<tailnet>.ts.net/opensearch.xml

The first should return JSON. A 403 means json is missing from formats. The second returns the OpenSearch description, and the project’s template builds absolute URLs from the instance address, so a wrong base_url shows up here as a wrong host. Every SearXNG page also links to that file in its head, which is how OpenSearch browsers find it.

Then open the address in a browser and search. A running instance with one blocked engine is normal; see Troubleshooting.

A SearXNG results page with engine names under each result and an info box on the right
Screenshot: a results page, with the engines that answered shown under every result (Benpiano800, CC BY 4.0, Wikimedia Commons)

Step 5 of 11: Make it the default on your iPhone

Apple’s own pages say where the default engine lives: Settings, then Apps, then Safari, then Search Engine in the iOS 26 guide, and the newest guide words it as Settings, Search, Search Engine. Either way, Apple’s pages describe choosing from a list, and nothing in them mentions adding your own address. The only choice screen Apple documents for search engines is in Japan; in the EU the choice screen is for browsers. So Safari on the iPhone cannot take SearXNG as a native default, as far as Apple documents it.

Your real options:

  • Use a browser that allows custom engines. Mozilla documents it for Firefox on iOS: Settings, Search, then add a search engine with a title and a URL where the query is %s. Orion’s help describes the same under Settings, Search Engine, with a + button. Brave on iOS has an Add Custom Search Engine option under Search Engines, per community pages, not official docs. The URL for all of them:
https://search.<tailnet>.ts.net/search?q=%s
  • Stay in Safari and add a redirect extension. The idea is documented by Kagi for its own engine: an extension rewrites searches to your engine while Safari still points at a stock one. For a self-hosted address MacStories describes two App Store apps, Redirect Web (regex rules that rewrite a search URL) and xSearch (keyword shortcuts in front of the query). I have not set these up, so I cannot vouch for them. The catch is that the query may reach the stock engine before it is rewritten; a Kagi feedback thread is titled “iOS extension leaking search queries”, so check what your extension does before you rely on it.
  • Use a client app. Searxist is a free GPL-3.0 app for iOS and macOS that talks to a SearXNG instance you add. Its page says it is not on the App Store yet, so on iPhone that means sideloading.
Table showing Safari on iPhone and Mac only offers Apple's list while Firefox, Orion and Brave on iOS accept a custom search URL

Step 6 of 11: Make it the default on your Android phone

Android is friendlier than iOS here, but it depends on the browser. First put the Tailscale app on the phone, sign in to your tailnet and keep it connected, because the address only works inside the tailnet.

Firefox. Mozilla documents adding your own engine in Firefox for Android. The steps in its support article are: tap the search icon in the address bar, open the search settings, tap Default search engine, then tap Add search engine at the bottom. Give it a name and put the address in the search string field, with %s where the query goes. Tap Save and then pick it as the default. If Firefox says the address is invalid, the %s is missing.

https://search.<tailnet>.ts.net/search?q=%s

Menu names move around between Firefox versions, so follow your own screen if it differs from the article.

Chrome. Google’s page for Chrome on Android only describes choosing from a list: tap More, then Settings, then Search engine under Basics, and pick one. The page says your recently visited search engines are added to that list, and the custom address form is documented only for the desktop version. The SearXNG docs say Chromium-based browsers only add websites that you open without a path. In practice that means opening your instance’s address, running a search there and checking the Search engine list afterwards. Community posts say this is how an engine shows up on Android, and I have not confirmed it for a private tailnet address, so try it and see.

I did not find official instructions for Brave or Vivaldi on Android, so I leave them out. If your browser has no way to add an engine, the simplest fallback is a bookmark or home screen shortcut to your instance.

Step 7 of 11: Make it the default on your Mac

Same story. Apple’s Safari documentation says to choose Safari, then Settings, then Search, where Search engine is the setting for regular browsing and Private Browsing search engine is separate. Apple’s page does not describe a custom address either. Firefox on the Mac lets you add a custom engine; the extension route in Safari works as described above.

The OpenSearch file is what makes this smooth in browsers that read it. Because every SearXNG page advertises /opensearch.xml, a supporting browser can offer to add the engine without you typing the URL; the file’s search address is built from base_url, so get that right first. I did not find any Apple page saying Safari uses it.

With a custom URL you can also pin the language: add &language=nl-NL, a parameter the search API documents.

Step 8 of 11: What this does to your privacy

A private instance does not make you anonymous. The SearXNG docs say so directly: the IP address used by the engines is the IP of the instance. When you run it at home, Google, Bing and the rest see your home connection, just not your browser, your cookies or your device. And since you are the only user, your queries are not mixed with anyone else’s, so an engine can see one steady stream from one address. The docs say SearXNG can also be set up to use a proxy or Tor.

The container template turns image_proxy on, so images load through your server instead of from the source. Be careful with !! bangs: the search syntax page warns that SearXNG cannot protect your privacy when a query goes straight to an external engine, and a lone !! that jumps to the first result has the same warning. And a server you own can log everything, so check what Docker keeps.

Step 9 of 11: Troubleshooting

  • CAPTCHAs and missing engines. Engines block server addresses, and a home IP is no exception. SearXNG suspends an engine after errors; the defaults in the settings reference are 86400 seconds after a CAPTCHA or access denied, 3600 after too many requests, and 604800 after a Google CAPTCHA. The docs even have a page on solving a CAPTCHA through an SSH SOCKS tunnel. I would rather remove engines that never work.
  • JSON returns 403. Add json to search.formats, restart.
  • Links point to the wrong address. base_url is unset or wrong.
  • Limiter blocks you. If you enabled it behind a proxy, the docs say forwarded headers are only trusted from addresses in trusted_proxies; add your proxy’s private range, or turn the limiter off on a private instance.
  • Updating. The docs give docker compose down, docker compose pull, docker compose up -d.
  • Serve stops answering. Check tailscale serve status, and that the device key has not expired (see my key expiry guide).

Step 10 of 11: My advice

I would keep the instance tailnet-only and not touch the limiter, public instance mode or Funnel. For daily use on iPhone I would decide between two choices: give up Safari as the search entry and use a browser that takes a custom URL, or accept a redirect extension and its trust cost. Pick one, because half-configured setups are the annoying ones. On the Mac I would add the engine in a second browser and keep Safari for everything else. And trim the engine list early: a few engines that work beat many that time out.

Step 11 of 11: Where to go next

Lock down who on the tailnet can reach it with Tailscale ACLs and tags, avoid a dead instance with key expiry and auth keys, keep the secret out of the file with Compose secrets and env files, add a healthcheck, and stop logs from growing with Docker log rotation. If you prefer a classic reverse proxy over Serve, my Nginx Proxy Manager guide shows the headers with another app.

Further reading

Link