Setting Up SearXNG For OpenClaw
A simple step-by-step guide to running SearXNG locally for OpenClaw
Introduction
SearXNG is a self-hosted metasearch engine. Instead of depending on one search provider, it can collect results from multiple search engines and make them available through one service you control.
This is useful for OpenClaw because an AI assistant becomes much more practical when it can look things up. Without search, OpenClaw can only work with what the model already knows, what you tell it, and what it can access on your computer. With search, it can help with current information, documentation, product research, troubleshooting, and daily summaries.
The reason I like SearXNG for this is that it keeps the workflow local-first. You can run it on your own computer, connect it to OpenClaw, and avoid setting up a paid search API while you are still testing your setup.
In this post, I want to show you how to run SearXNG locally and prepare it so OpenClaw can use it as a search provider.
[!TIP] 💡 Tip This tutorial focuses on local use. If you later expose SearXNG to the internet, you should read more about reverse proxies, rate limiting, and access control first.
What You Need
Before starting, make sure you have:
- A Mac or Linux machine
- Access to Terminal
- Docker installed
- A working OpenClaw setup
If you have not set up OpenClaw yet, you can follow my local OpenClaw setup guide first.
[!WARNING] ⚠️ For Windows Users It’s better to run this through WSL (Windows Subsystem for Linux) rather than native PowerShell.
Setting Up SearXNG
Creating a SearXNG folder
First, create a folder for your local SearXNG setup:
mkdir -p ~/searxng
cd ~/searxng
Inside this folder, we will keep the SearXNG configuration file.
Creating the settings file
Create a file called settings.yml:
nano settings.yml
Then paste this into it:
use_default_settings: true
general:
instance_name: "Local SearXNG"
search:
safe_search: 1
formats:
- html
- json
server:
secret_key: "change-this-to-a-random-secret"
bind_address: "0.0.0.0"
port: 8080
limiter: false
image_proxy: true
Save the file and exit.
[!WARNING] ⚠️ Change The Secret Key Do not leave the secret key as
change-this-to-a-random-secret. You can generate a better one withopenssl rand -hex 32.
The important part here is:
formats:
- html
- json
OpenClaw needs a search result format it can read programmatically. For SearXNG, that usually means enabling JSON output.
Starting SearXNG
Now start SearXNG with Docker:
docker run -d \
--name searxng \
-p 8080:8080 \
-v "$PWD/settings.yml:/etc/searxng/settings.yml:ro" \
-e SEARXNG_BASE_URL="http://localhost:8080/" \
searxng/searxng:latest
This will download the SearXNG image and start it on your computer.
You can check if it is running with:
docker ps
You should see searxng in the list.
[!NOTE] ℹ️ Note In this tutorial, we named the container searxng with
--name searxng. Some setups may use a different name, such as searxng-core. If your container has a different name, use that name in the Docker commands below.
Testing SearXNG in your browser
Open this in your browser:
http://localhost:8080
Try searching for something simple, like:
OpenClaw AI
If you see search results, the basic SearXNG setup is working.
Testing the JSON search API
Next, test the search API that OpenClaw will use:
curl "http://localhost:8080/search?q=openclaw&format=json"
If everything is working, you should see a JSON response in your terminal.
[!TIP] 💡 Tip If you get a
403 Forbiddenerror, check thatjsonis listed undersearch.formatsin settings.yml, then restart the container.
To restart SearXNG after changing settings, run:
docker restart searxng
Connecting SearXNG To OpenClaw
Now that SearXNG is running, we can point OpenClaw to it.
Open your OpenClaw settings or onboarding flow and look for the Search provider section. Choose SearXNG if it is listed.
When it asks for the SearXNG URL, use:
http://localhost:8080
If OpenClaw asks for a full search endpoint instead, use:
http://localhost:8080/search
After saving the setting, ask OpenClaw to search for something current or specific. For example:
Search the web for the latest OpenClaw documentation and summarize the setup steps.
If OpenClaw returns web results instead of saying it cannot search, the connection is working.
[!NOTE] ℹ️ Note If OpenClaw is running inside a Docker container,
localhostmay point to the OpenClaw container instead of your computer. In that case, tryhttp://host.docker.internal:8080on Mac, or use your machine’s local network IP address on Linux.
Useful Docker Commands
Before running Docker commands, check your actual SearXNG container name:
docker ps -a
Look at the NAMES column. In this tutorial, the name should be searxng because we started it with --name searxng. If your setup shows searxng-core or another name, use that name instead.
To stop SearXNG:
docker stop CONTAINER_NAME
To start it again:
docker start CONTAINER_NAME
To see the logs:
docker logs -f CONTAINER_NAME
To remove the container:
docker rm -f CONTAINER_NAME
Troubleshooting
SearXNG does not open
Check that Docker is running:
docker ps
If SearXNG is not listed, start it again:
docker start searxng
The JSON API returns 403
Open settings.yml and make sure this section includes json:
search:
formats:
- html
- json
Then restart SearXNG:
docker restart searxng
Search results are slow or incomplete
This can happen because SearXNG depends on external search engines. Some engines may block requests, rate limit you, or respond slowly.
For a personal local setup, this is normal. If one engine gives you trouble often, you can later customize the engines in settings.yml.
Conclusion
With SearXNG running locally, OpenClaw can use web search without needing a paid search API.
From here, you can start experimenting with search-based workflows, research tasks, and daily summaries. For example, you can get OpenClaw to fetch news on a schedule.
Want this set up for your business?
I help small and medium businesses implement AI tools that actually save time and money.
Book a free consultation