Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on lemmy.today

Hosting SearXNG behind a VPN

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.

::: spoiler 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;
  }
}

:::

View original on lemmy.today
16

2 replies

@rounding_error I use a gluten docker container using proton VPN and route my SearXNG docker container traffic through it. Is that basically the same as using the SearXNG config to do it?

0

Uhm, well I don’t think there’s a searXNG config line for that. I basically just copied what my qbit container had for network_mode and made sure to expose the 8080 in gluetun instead of searXNG. Then, I had nginx point to gluetun’s container name to provide https.

1

You reached the end

Hosting SearXNG behind a VPN | Spyke