Setting Up SearXNG: Your Private Search Engine via Docker

In Uncategorized by dbtech

In today’s digital landscape, online privacy is not just a luxury; it’s a necessity. Every search we conduct online leaves a trail of data that can be collected, analyzed, and often sold to the highest bidder. Many people are becoming more aware of how their information is being used, leading to an increased interest in privacy-centric tools. One such tool is SearXNG, a versatile and privacy-respecting meta search engine. This article guides you through setting up your own SearXNG instance using Docker, providing a secure space for your web searches.

What is SearXNG?

SearXNG is a meta search engine, which means it collates results from various search engines rather than relying on one, such as Google or Bing. This approach not only diversifies your search results but also enhances your privacy. When you use SearXNG, your queries are not tied to your identity, making it a perfect alternative for anyone concerned about online tracking.

Why Choose SearXNG over Other Search Engines?

  • Privacy: Your searches are not tracked or stored.
  • Customization: Users can tailor their search experience by choosing preferred sources or disabling cookies and trackers.
  • Open Source: The code is available for anyone to use or modify, ensuring transparency and control.
  • Community Driven: SearXNG is maintained and developed by a community committed to privacy.

Setting Up SearXNG with Docker

Prerequisites

Before you begin, ensure you have the following:

  • A server with Docker installed (can be a local machine or cloud instance).
  • Basic knowledge of command-line operations.

Step 1: Pulling the SearXNG image

To get started, open your terminal or command prompt and pull the SearXNG Docker image by running:

docker pull searxng/searxng


This command downloads the latest version of SearXNG.

Step 2: Creating the Docker Compose file

Next, create a docker-compose.yml file. This file will allow you to define how the Docker containers should behave. Use the following example:

services:
  redis:
    container_name: redis
    image: docker.io/valkey/valkey:8-alpine
    command: valkey-server --save 30 1 --loglevel warning
    restart: unless-stopped
    networks:
      - searxng
    volumes:
      - valkey-data:/data
    cap_drop:
      - ALL
    cap_add:
      - SETGID
      - SETUID
      - DAC_OVERRIDE
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"

  searxng:
    container_name: searxng
    image: docker.io/searxng/searxng:latest
    restart: unless-stopped
    networks:
      - searxng
    ports:
      - "8181:8080" #change 8181 as needed, but not 8080
    volumes:
      - searxng:/etc/searxng:rw
    environment:
      - SEARXNG_BASE_URL=http://your.docker.server.ip:8080/ #Change "your.docker.server.ip" to your Docker server's IP
      - UWSGI_WORKERS=4 #You can change this
      - UWSGI_THREADS=4 #You can change this
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"

networks:
  searxng:

volumes:
  valkey-data: #redis storage
  searxng: #searxng storage


In this example, we define a single service, searxng, which will listen on port 8080. The volume searxng is created to store configuration files persistently, and the service is set to restart unless manually stopped.

Step 3: Deploying the Docker Compose

Navigate to the directory containing your docker-compose.yml file and deploy the Docker stack by running:

docker-compose up -d


This command starts SearXNG in detached mode. You can check if it’s running properly with:

docker ps

You should see searxng listed in the output.

Step 4: Accessing SearXNG

Once the deployment is successful, you can access your SearXNG instance by navigating to http://<your-server-ip>:8080 in your web browser. You will see a simple and intuitive interface where you can start searching without worrying about being tracked.

Configuring SearXNG

General Preferences

After accessing SearXNG, you’ll want to configure your preferences to tailor the search results. You can control options like:

  • Default Categories: General, images, news, videos, and more.
  • Search Language: Set it to autodetect or manually choose a preferred language.
  • Auto-complete: Decide if you’d like this feature enabled or disabled.

Engine Selection

One of the most powerful features of SearXNG is its ability to select which search engines to query. You can toggle various engines on or off based on your preferences. Popular options include:

  • Google
  • DuckDuckGo
  • Bing
  • Wikipedia

This flexibility can include plugins for direct searches and shortcuts for quicker access to specific types of results.

Ensuring Privacy Settings

Privacy is paramount when using any search engine. Within the preferences, ensure you have the following settings configured for optimal privacy:

  • Tracker Removal: Enabled by default to ensure no trackers are collected during search.
  • HTTPS Enforcement: Ensure that your traffic is encrypted when accessing results.
  • Image Proxy: This feature can be enabled to hide your IP address when fetching images.

Understanding SearXNG’s Transparency

SearXNG prides itself on being transparent and open. You can review the source code and documentation available on GitHub. This resource is invaluable for users who would like to dig deeper into how SearXNG operates or contribute to its development.

Conclusion

Setting up your private search engine with SearXNG is both a straightforward and rewarding experience. It not only enhances your privacy but also provides a customized search experience that’s hard to achieve with mainstream search engines. By following the simple steps outlined in this guide, you can create a personalized search engine that respects your privacy and puts you in control of your data.

Explore SearXNG today and take the first step towards safer browsing. If you’re curious or have further questions about the setup, feel free to drop a comment!

Start your journey towards a more secure online search experience today!

Resource Links: