Table of Contents

SearXNG

SearXNG is a search engine aggregator that let's you search the web with maximum privacy because it will use the other search engines, but without having them pinpoint to you in any way. And by self-hosting it, you get the maximum possible privacy.

Installation

There are multiple installation approaches possible. You can either go with containers or bare-metal. While i usually recoment bare-metal, this time going the podman way is actually recomended because the bare-metal approach requires running a root install script, which is not a good idea, or read it and decompose enough to run the single commands by hand, which would be annoying and not too much fun because the install script is complex and well written.

So, as usual create the user and clone the repo and copy the compose yaml

useradd -d /deposito/daemons/searxng -m searxng
su - searxng
git clone https://github.com/searxng/searxng-docker.git
 cp searxng-docker/docker-compose.yaml .

Now you don't want Caddy because you already have NGINX as reverse proxy, so :

docker-compose.yml
version: "3.7"
services:
  searxng:
    container_name: searxng
    image: docker.io/searxng/searxng:latest
    networks:
      - searxng-net
    ports:
      - "127.0.0.1:8083:8080"
    volumes:
      - ./searxng:/etc/searxng:rw
    environment:
      - SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"

networks:
  searxng_net:
    ipam:
      driver: default

volumes:
  caddy-data:
  caddy-config:
  redis-data:

Remember to set an available port (8083)!

Now pull and start it:

podman compose pull

To start it, and set it up on boot, as usual check Custom User Services and do the following links:

cd /etc/local.d ln -s _servicer.sh 21-searxng--podman.start ln -s _servicer.sh 21-searxng--podman.stop
 

You can start it now by running the above start link.

Reverse Proxy

Following this page create a NGINX config file called searxng.conf like this:

searxng.conf
location /searxng/ {

    proxy_pass http://127.0.0.1:8083/;

    proxy_set_header   Host             $host;
    proxy_set_header   Connection       $http_connection;

    # see flaskfix.py
    proxy_set_header   X-Scheme         $scheme;
    proxy_set_header   X-Script-Name    /searxng/;

    # see limiter.py
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

    # proxy_buffering  off;
    # proxy_request_buffering off;
    # proxy_buffer_size 8k;

    access_log /dev/null;
    error_log  /dev/null;

}

and add it to your NGINX configuration. See The Reverse Proxy concept for more details.