Self-hosting
Self-host your own search engine with SearXNG
Run a private SearXNG search engine on a Linux server using Docker Compose, then access it from your local network or through a VPN.
SearXNG is a free, open-source metasearch engine. Instead of maintaining its own index of the web, it gathers results from other search engines and displays them in one place. Running your own instance gives you control over the configuration and which devices can use it.
SearXNG still sends search requests to external search services. Self-hosting it does not mean that searches happen entirely offline or that it makes you completely anonymous.
Prerequisites
You need:
- a Linux server with Internet access (this guide uses Debian as example)
- terminal or SSH access to that server
- Docker Engine and the Docker Compose plugin installed
- a local network connection between the server and the device you will search from
If Docker is not installed yet, follow the official instructions for your distribution:
Once Docker is installed, confirm that it works:
docker --version
docker compose versionYou should see version information for both Docker and Compose. You will also need curl and openssl; on Debian or Ubuntu you can install them with sudo apt update && sudo apt install -y curl openssl.
Find your server’s IP address
On the Linux server, run:
hostname -ILook for its local network address. For example:
192.168.1.100Download the SearXNG configuration
Create a directory for SearXNG and enter it:
mkdir -p ~/searxng/core-config
cd ~/searxngDownload the official Docker Compose file and example environment file:
curl -fsSL \
-O https://raw.githubusercontent.com/searxng/searxng/master/container/docker-compose.yml \
-O https://raw.githubusercontent.com/searxng/searxng/master/container/.env.exampleCreate your own environment file from the example:
cp .env.example .envThe Compose file starts two services: SearXNG, which serves the search page, and Valkey, which can support its request limiter. Valkey is only available to the containers in this Compose project; it is not published as a separate web service.
Configure the server address
Open the environment file:
nano .envAdd these lines below the existing comments:
SEARXNG_HOST=192.168.1.100
SEARXNG_PORT=8080Replace 192.168.1.100 with your Linux server’s LAN IP address. Save the file and exit the editor.
This tells Docker to listen on the server’s local network address, using port 8080. If you use a different port, remember to use that same port when opening SearXNG in your browser.
Next, generate a random secret key and add it to .env:
printf 'SEARXNG_SECRET=%s\n' "$(openssl rand -hex 32)" >> .env
chmod 600 .envConfigure SearXNG
Create the main SearXNG settings file:
nano core-config/settings.ymlPaste the following configuration:
use_default_settings: true
general:
instance_name: 'My SearXNG'
search:
autocomplete: 'duckduckgo'
formats:
- html
server:
limiter: true
image_proxy: true
valkey:
url: valkey://valkey:6379/0Save the file.
Here’s what the most important options do:
use_default_settings: truekeeps SearXNG’s normal search engines and settings unless you override them.instance_namechanges the name shown on your search page.autocompleteenables suggestions while you type.limiterhelps protect the instance against excessive automated requests.image_proxylets SearXNG proxy images rather than having your browser request every image directly.valkey.urlconnects the limiter to the Valkey service included in the Compose setup.
Start SearXNG
Make sure you are still in the ~/searxng directory:
cd ~/searxngCheck the Compose configuration for errors:
docker compose config --quietIf there are no errors, start the services:
docker compose up -dDocker will download the required images the first time you run this command.
Check that the containers are running:
docker compose psYou should see services named searxng-core and searxng-valkey with a running status.
Open your search engine
On a computer or phone connected to the same home network, open:
http://192.168.1.100:8080Replace the IP address with the one you found earlier.
You should see the SearXNG search page. Search anything. If you see search results, your instance is working.
You can also open the Preferences page to change the language, appearance, search categories, and enabled search engines.
Set SearXNG as your default search engine in Brave
Once SearXNG is working, you can search directly from Brave’s address bar without visiting the SearXNG homepage first. These steps are for Brave on desktop (Windows, macOS, or Linux).
1. Open Brave’s search engine settings
Open Brave and enter the following in the address bar:
brave://settings/searchEnginesThis opens Manage search engines and site search. You can also reach it through Settings → Search engine → Manage search engines and site search.
2. Add SearXNG
Find the Site search section and click Add. Fill in the fields as follows:
| Field | Value |
|---|---|
| Search engine | SearXNG |
| Shortcut | @searxng |
| URL with %s in place of query | http://192.168.1.100:8080/search?q=%s |
Replace 192.168.1.100 with your server’s IP address. If you use a private HTTPS domain through a reverse proxy, you can use that instead, for example:
https://search.home.arpa/search?q=%sClick Save.
3. Make SearXNG the default
Find the new SearXNG entry under Site search, click the three-dot menu (⋮) next to it, and select Make default. Brave should move it into the Search engines section.
Done!
You now have a self-hosted search engine that you can customize, use as your browser’s default, and access privately from the devices in your homelab.
For more configuration options, see the official documentation: