# Searx

Self hosted metasearch. Prevent profiling by major search engines

## Inspiration / Further Reading

- [https://asciimoo.github.io/searx/](https://asciimoo.github.io/searx/)
- [https://github.com/asciimoo/morty](https://github.com/asciimoo/morty)
- [https://asciimoo.github.io/searx/user/own-instance.html](https://asciimoo.github.io/searx/user/own-instance.html)

## Install / Update / Run Script

Setup a generic script that'll auto update Searx, build a container and launch it. You should only run this script at first launch and/or when you're looking for updates.

``` bash

mkdir -p /var/searx
chown root:root /var/searx
mkdir -p /scratch/docker/searx
cat > /scratch/docker/searx/searx.sh << EOF
#!/bin/bash

ARCH=\`arch\`
if [ \$ARCH == "aarch64" ]
then
    ARCH="arm64v8"
else
    ARCH="arm32v7"
fi

docker pull registry.lollipopcloud.solutions/\$ARCH/searx:latest

docker stop searx
docker rm searx

docker run \\
    --name searx \\
    --restart unless-stopped \\
    --net docker-private \\
    --ip 172.30.8.8 \\
    -e TZ=UTC \\
    -e DEBUG=1 \\
    -e BASE_URL=searx.kemonine.online \\
    registry.lollipopcloud.solutions/\$ARCH/searx:latest
EOF

chmod a+x /scratch/docker/searx/searx.sh

```

## Run Searx

Simply execute ```/scratch/docker/searx/searx.sh``` to update/run Gogs.

## Serving Via Caddy

``` bash

cat > /etc/caddy/services/searx.conf <<EOF
# Searx proxy
searx.domain.tld {
    tls user@domain.tld
    
    redir 301 {
        if {scheme} is http
        /  https://searx.domain.tld{uri}
    }

    log /var/log/caddy/searx.log
    proxy / 172.30.8.8:8888 {
        transparent
    }
}
EOF

```

## Update Unbound

``` bash

cat > /etc/unbound/local_zone/searx.conf <<EOF
local-data: "searx-insecure A 172.30.8.8"
local-data-ptr: "172.30.8.8 searx-insecure"
local-data: "searx-insecure.domain.tld A 172.30.8.8"
local-data-ptr: "172.30.8.8 searx-insecure.domain.tld"

local-data: "searx A 172.30.0.1"
local-data-ptr: "172.30.0.1 searx"
local-data: "searx.domain.tld A 172.30.0.1"
local-data-ptr: "172.30.0.1 searx.domain.tld"
EOF

```

## Configuration (Optional)

See [https://github.com/asciimoo/searx/blob/master/searx/settings.yml](https://github.com/asciimoo/searx/blob/master/searx/settings.yml) for additional details. You shouldn't need to run any configuration as the defaults are quite reasonable.