美文网首页
2023-05-13 Searx本地化部署脚本填坑

2023-05-13 Searx本地化部署脚本填坑

作者: 无极小屋 | 来源:发表于2023-07-16 00:10 被阅读0次

https://github.com/searx
https://searx.github.io/searx/index.html

本文所用vps系统 debian11,arm64处理器

一键脚本中,如果直接使用,失败概率估计会比较高。需要修改其中的部分内容

$ sudo -H ./utils/searx.sh install all

  • python版本大于3.0时,执行python需要使用python3 ...,而不是python ...

$ sudo -H ./utils/filtron.sh install all

  • 因为本人vps的cpu为arm64架构,所以安装go需要修改为arm64包,使用amd包会安装失败。(根据实际情况)
    GO_PKG_URL="https://dl.google.com/go/go1.20.4.linux-arm64.tar.gz"
    版本使用最新版即可。
  • 最新版go命令和老版本已经不同,原脚本中使用的时go get -v -u ...,并且不需要版本号,新版本需要使用go install -v ...@latest ,其中-u已经被废弃,删除即可,@latest表示最新版本,或者可以指定其他版本。脚本中go命令编译使用比较多,需要全部修改。具体修改为:此脚本中改为 go install -v github.com/asciimoo/filtron@latest即可。
  • filtron主要用于安全规则,防止搜索被恶意使用,但是searx默认配置有坑,会导致搜索一直报错429,"Rate limit exceeded"。searx setting配置后面会说明

$ sudo -H ./utils/morty.sh install all

Nginx配置

在监听端口(80/443)中添加如下

# https://example.org/searx

location  /searx  {
  proxy_pass  http://127.0.0.1:4004/;
  proxy_set_header  Host  $host;
  proxy_http_version 1.1;
  proxy_set_header  Connection  $http_connection;
  proxy_set_header  X-Real-IP  $remote_addr;
  proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
  proxy_set_header  X-Scheme  $scheme;
  proxy_set_header  X-Script-Name  /searx;
}

location  /searx/static/  {
  alias  /usr/local/searx/searx-src/searx/static/;
}

#为 [morty](https://searx.github.io/searx/admin/morty.html#searx-morty) 配置反向代理,监听 本地主机 3000 
# https://example.org/morty

location  /morty  {
  proxy_pass  http://127.0.0.1:3000/;
  proxy_http_version 1.1;
  proxy_set_header  Host  $host;
  proxy_set_header  Connection  $http_connection;
  proxy_set_header  X-Real-IP  $remote_addr;
  proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
  proxy_set_header  X-Scheme  $scheme;
}

searx setting配置

默认配置:https://github.com/searx/searx/blob/master/searx/settings.yml

use_default_settings: True    #未显式写明的配置使用默认配置

general:
    debug : False # Debug mode, only for development
    instance_name : "searx" # displayed name
    contact_url: "contact@example.com" # mailto:contact@example.com

search:
    safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
    autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default
    default_lang : "en" # Default search language - leave blank to detect from browser information or use codes from 'languages.py'

server:
    port : 8888
    bind_address : "127.0.0.1" # address to listen on
    secret_key : "**********" # change this!
    # Set custom base_url. Possible values: False or "https://xxx.com/searx" 。如不加/searx需要在nginx配置使https://xxx.com可以直接访问搜索页面
    base_url : "https://xxx.com/searx" 
    image_proxy : True # Proxying image results through searx
    http_protocol_version : "1.1"  # 1.0 and 1.1 are supported  默认1.0会导致一直被filtron规则拦截 429错误,被Header:Connection=close拦截,报错:Rate limit exceeded。

# uncomment below section if you have running morty proxy
result_proxy:
    url: "https://xxx.com/morty"    #公共实例填写域名
    key: !!binary "********"

ui:
    theme_args :
        oscar_style : "logicodev-dark" # default style of oscar 黑暗主题
    results_on_new_tab : True  #新标签打开搜索结果条目

outgoing: # communication with search engines
    request_timeout : 3.0 # default timeout in seconds, can be override by engine

engines:
# 开启duckduckgo搜索

    - name : duckduckgo
    engine : duckduckgo
    shortcut : ddg
#    disabled : True

    - name : duckduckgo images
    engine : duckduckgo_images
    shortcut : ddi
    timeout: 3.0
#    disabled : True

默认配置文件位置

/usr/local/searx/searx-src/searx/settings.yml

个性化配置文件位置

/etc/searx/settings.yml

firefox解决bing没有搜索结果

#    searx/data/useragents.json
#使用firefox最新版本
{
    "versions": [
-        "75.0",
-        "74.0.1",
-        "74.0"
+        "84.0.1",
+        "84.0",
+        "83.0"
    ],
    "os": [
        "Windows NT 10.0; WOW64",
        "X11; Linux x86_64"
    ],
    "ua": "Mozilla/5.0 ({os}; rv:{version}) Gecko/20100101 Firefox/{version}"
}

服务重启命令

# sudo -H systemctl restart filtron.service
# sudo -H systemctl restart morty.service
# sudo -H service uwsgi restart searx
# sudo -H systemctl restart openresty

*转载请注明来源

相关文章

网友评论

      本文标题:2023-05-13 Searx本地化部署脚本填坑

      本文链接:https://www.haomeiwen.com/subject/urjysdtx.html