Tutorial navigation
On this page

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.

beginnerPublished Updated
  • searxng
  • docker
  • homelab
  • privacy
  • search-engine

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:

bash
docker --version
docker compose version

You 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:

bash
hostname -I

Look for its local network address. For example:

text
192.168.1.100

Download the SearXNG configuration

Create a directory for SearXNG and enter it:

bash
mkdir -p ~/searxng/core-config
cd ~/searxng

Download the official Docker Compose file and example environment file:

bash
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

Create your own environment file from the example:

bash
cp .env.example .env

The 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:

bash
nano .env

Add these lines below the existing comments:

dotenv
SEARXNG_HOST=192.168.1.100
SEARXNG_PORT=8080

Replace 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:

bash
printf 'SEARXNG_SECRET=%s\n' "$(openssl rand -hex 32)" >> .env
chmod 600 .env

Configure SearXNG

Create the main SearXNG settings file:

bash
nano core-config/settings.yml

Paste the following configuration:

yaml
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/0

Save the file.

Here’s what the most important options do:

  • use_default_settings: true keeps SearXNG’s normal search engines and settings unless you override them.
  • instance_name changes the name shown on your search page.
  • autocomplete enables suggestions while you type.
  • limiter helps protect the instance against excessive automated requests.
  • image_proxy lets SearXNG proxy images rather than having your browser request every image directly.
  • valkey.url connects the limiter to the Valkey service included in the Compose setup.

Start SearXNG

Make sure you are still in the ~/searxng directory:

bash
cd ~/searxng

Check the Compose configuration for errors:

bash
docker compose config --quiet

If there are no errors, start the services:

bash
docker compose up -d

Docker will download the required images the first time you run this command.

Check that the containers are running:

bash
docker compose ps

You 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:

text
http://192.168.1.100:8080

Replace 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:

text
brave://settings/searchEngines

This 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:

text
https://search.home.arpa/search?q=%s

Click 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:

https://docs.searxng.org/admin/installation-docker.html