Introduction
Welcome to another week of self-hosting various services in my homelab. This week, we’ll be exploring search engines - specifically, how to maintain privacy while searching the web.
Search engines are our primary gateway to the internet i.e we use them to find information, products, services, etc. However, most popular search engines track our searches, build profiles, and use this data for targeted advertising. While there are privacy-focused alternatives like DuckDuckGo, Kagi, etc. having your own metasearch engine gives you complete control over your search experience.
That’s where SearXNG comes in - a powerful, privacy-focused metasearch engine that you can self-host. What makes it special isn’t just its commitment to privacy, but how it aggregates results from multiple search engines while keeping your searches private.
What is a Metasearch Engine?
A metasearch engine is a search tool that queries multiple search engines (can be as few as 1) simultaneously and combines their results into a single, unified response. Think of it as a search aggregator that:
- Distributes Queries: Sends your search to multiple search engines
- Aggregates Results: Combines and deduplicates results from different sources
- Maintains Privacy: Acts as an intermediary, preventing direct tracking
- Customizes Experience: Allows you to choose which engines to include
What is SearXNG?
SearXNG ↗️ is a free internet metasearch engine that aggregates results from various search services and databases. It’s a fork of Searx ↗️ with additional features and improvements.
What really drew me to SearXNG was its comprehensive feature set:
-
Privacy Features:
- No tracking or profiling
- No cookies by default
- Proxy support for anonymous requests
-
Search Capabilities:
- Support for 230+ search engines
- Category-based search
- Time-based filtering
- Language preferences
- Safe search options
-
User Experience:
- Clean, minimalist interface
- Mobile-friendly design
- Keyboard shortcuts
- Customizable themes
- Multiple language support
-
Technical Features:
- Docker support
- API access
- Proxy support
- Rate limiting
- Caching options
The project is open-source and actively maintained. You can check out their GitHub repository ↗️ for more details.
Setup SearXNG
Once again, I am going to be using Docker to run SearXNG in my homelab. First, create a new directory:
mkdir searxng && cd searxng
Here’s my docker-compose configuration:
services: searxng: image: "docker.io/searxng/searxng:latest" container_name: "searxng" volumes: - "./config:/etc/searxng:rw" ports: - "8080:8080" environment: - PGID=1000 - PUID=1000 - SEARXNG_BASE_URL=https://search.mydomain.com - SEARXNG_REDIS_URL=redis://redis:6379/0 - UWSGI_WORKERS=4 - UWSGI_THREADS=4 cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID depends_on: redis: condition: service_healthy restart: unless-stopped
redis: container_name: searxng-redis image: docker.io/valkey/valkey:8-alpine command: valkey-server --save 30 1 --loglevel warning restart: unless-stopped volumes: - "redis-data:/data" cap_drop: - ALL cap_add: - SETGID - SETUID - DAC_OVERRIDE - CHOWN healthcheck: test: ["CMD", "valkey-server", "--version"] interval: 10s timeout: 5s retries: 3 start_period: 10s
volumes: redis-data:
Create the necessary directories:
mkdir -p {config}
Now you can start SearXNG:
docker compose up -d
The above setup uses Redis as the cache backend with Valkey as the Redis server, however you can use any other Redis server or even no cache at all.
Enjoying the content? Support my work! 💝
Your support helps me create more high-quality technical content. Check out my support page to find various ways to contribute, including affiliate links for services I personally use and recommend.
Configuration and Customization
After setting up SearXNG, here are some important configurations I recommend:
-
Search Engine Selection:
- Go to Preferences → Search engines
- Enable engines based on your needs
- I recommend enabling:
- General: Google, Bing, DuckDuckGo
- News: wikinews
-
Privacy Settings:
- Enable “Safe search” if needed
- Set “Results per page” to your preference
- Configure “Time range” defaults
- Set your preferred language
-
Performance Tuning:
- Adjust worker and thread counts based on your server
- Configure caching if needed
- Set up rate limiting to prevent abuse
Integration with Librewolf
I use Librewolf ↗️ as my primary browser, and I’ve configured it to use my self-hosted SearXNG instance as the default search engine. Here’s how to do it:
-
Open Librewolf settings (Or directly go to
about:preferences#search
) -
Go to Search
-
Click “Add Search Engine”
-
Enter the following details:
- Name: SearXNG
- URL:
https://search.mydomain.com/search?q=%s
-
Set it as the default search engine.
Features I Love
After using SearXNG for several months, here are some features that I find particularly useful:
-
Privacy First: No tracking, no cookies, no history - just pure search.
-
Customizable Interface: Clean, minimalist design that’s easy to use.
-
Multiple Search Engines: Results from various sources give me comprehensive results.
-
Category-based Search: Helps me find specific types of content more efficiently.
Conclusion
SearXNG has become my go-to search solution, providing a perfect balance of privacy, functionality, and control. Combined with Librewolf, it creates a privacy-focused browsing experience that I can trust.
Do you use SearXNG or similar privacy-focused search solutions in your homelab? What are your favorite features? Share your experiences in the comments below, or reach out to me on Twitter ↗️ / Reddit ↗️.
Happy searching! 🔍