searxng搜索引擎搭建踩坑记录

你在国内

使用开源的联网的聚合工具在国内网络必定踩坑🤢

克隆仓库

git clone <https://github.com/searxng/searxng-docker.git>

环境变量

填下面两个内容,主要是为了减小并发,不然内存占用非常大。

UWSGI_WORKERS=4
UWSGI_THREADS=4

配置文件

新增一个配置文件,文件名:/etc/searx/settings.yml 文件内容:

general:
  debug: false
  instance_name: "searxng"
  privacypolicy_url: false
  donation_url: false
  contact_url: false
  enable_metrics: true
  open_metrics: ''

brand:
  new_issue_url: https://github.com/searxng/searxng/issues/new
  docs_url: https://docs.searxng.org/
  public_instances: https://searx.space
  wiki_url: https://github.com/searxng/searxng/wiki
  issue_url: https://github.com/searxng/searxng/issues

search:
  safe_search: 0
  autocomplete: ""
  autocomplete_min: 4
  default_lang: "auto"
  ban_time_on_fail: 5
  max_ban_time_on_fail: 120
  formats:
    - html
    - json

server:
  port: 8080
  bind_address: "0.0.0.0"
  base_url: false
  limiter: false
  public_instance: false
  secret_key: "eadmin2a@woejt9u2gh4trb2orn3km4e131xample"
  image_proxy: false
  http_protocol_version: "1.0"
  method: "POST"
  default_http_headers:
    X-Content-Type-Options: nosniff
    X-Download-Options: noopen
    X-Robots-Tag: noindex, nofollow
    Referrer-Policy: no-referrer

redis:
  url: false
ui:
  static_path: ""
  static_use_hash: false
  templates_path: ""
  default_theme: simple
  default_locale: ""
  query_in_title: false
  infinite_scroll: false
  center_alignment: false
  theme_args:
    simple_style: auto

outgoing:
  request_timeout: 30.0
  max_request_timeout: 40.0
  pool_connections: 200
  pool_maxsize: 50
  enable_http2: false
  retries: 5

engines:
  - name: baidu
    baidu_category: general
    categories: [general]
    engine: baidu
    shortcut: bd
    disabled: false

  - name: bilibili
    engine: bilibili
    shortcut: bil
    disabled: false

  # 360 搜索
  - name: 360search
    engine: 360search
    shortcut: 360so

doi_resolvers:
  oadoi.org: 'https://oadoi.org/'
  doi.org: 'https://doi.org/'
  doai.io: 'https://dissem.in/'
  sci-hub.se: 'https://sci-hub.se/'
  sci-hub.st: 'https://sci-hub.st/'
  sci-hub.ru: 'https://sci-hub.ru/'

default_doi_resolver: 'oadoi.org'

启动

docker compose down

docker-compose up -d

国内Bing时好时坏 ,并且其他的搜索引擎都用不了 ,导致默认配置文件根本不能用,请求直接报错。

在国内服务器上使用我只支持了 以上三种搜索。