If it helps others this was my config. To be honest I have a weak grasp of what it actually does so there might be some security issues with it.

Apparently you can also add lemmy as a search engine. Will work on that later.

config
# docker-compose.yml
name: searxng

services:
  core:
    container_name: searxng-core
    image: docker.io/searxng/searxng:latest
    restart: always
    network_mode: "service:gluetun"
    volumes:
      - ./core-config:/etc/searxng
      - core-data:/var/cache/searxng

  gluetun:
    image: qmcgaw/gluetun:v3.41.3
    container_name: gluetun
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=openvpn
      - OPENVPN_CUSTOM_CONFIG=/gluetun/custom.conf
    ports:
      - 8080:8080
    restart: always
    volumes:
      - ./gluetun:/gluetun
    devices:
      - /dev/net/tun:/dev/net/tun

  nginx:
    container_name: nginx
    image: nginx:latest
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx:/etc/nginx/conf.d
      - ./cert:/etc/nginx/cert

  valkey:
    container_name: searxng-valkey
    image: docker.io/valkey/valkey:9-alpine
    command: valkey-server --save 30 1 --loglevel warning
    restart: always
    volumes:
      - valkey-data:/data/

volumes:
  core-data:
  valkey-data:

# nginx/default.conf
server {
  server_name localhost;
  listen 443 ssl;

  ssl_certificate /etc/nginx/cert/cert.pem;
  ssl_certificate_key /etc/nginx/cert/private.key;

  location / {
    proxy_pass http://gluetun:8080/;

    proxy_set_header   Host             $host;
    proxy_set_header   Connection       $http_connection;

    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
  }
}

server {
  server_name localhost;
  listen 80;
  location / {
    return 301 https://$host$request_uri;
  }
}
  • isgleas@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 hours ago

    I run the container locally, and set up 127.0.0.1 as search engine on my browsers. It works for me, as I do not use search on mobile as much.