SearXNG 能聚合來自多達 200 多個搜索服務,可私有化部署,并提供了靈活自定義選項。
AnythingLLM+SearXNG,剛好能解決AnythingLLM因為網絡限制導致web search不可用的問題。
1 安裝docker
下載mac m1版本的docker并安裝。
https://docs.docker.com/desktop/setup/install/mac-install/
更新docker mirror信息
docker pull docker-0.unsee.tech/istio/distroless
由于SearXNG依然不能正常pull,進一步
修改docker mirror,具體位置
內容如下
{"builder": {"gc": {"defaultKeepStorage": "20GB","enabled": true}},"experimental": false,"features": {"buildkit": true},"registry-mirrors": ["https://docker.1panel.dev","https://docker.fxxk.dedyn.io","https://docker.xn--6oq72ry9d5zx.cn","https://docker.m.daocloud.io","https://a.ussh.net","https://docker.zhai.cm"]
}
然后docker就能正常pull了
2 安裝SearXNG
1)docker安裝SearXNG
這里選擇docker命令進行部署。
mkdir my-searxng
cd my-searxng
export PORT=8080
docker pull searxng/searxng
docker run --rm \-d -p ${PORT}:8080 \-v "${PWD}/searxng:/etc/searxng" \-e "BASE_URL=http://localhost:$PORT/" \-e "INSTANCE_NAME=searxng" \searxng/searxng
部署過程中有可能會遇到如下問題,解決方案參考附錄
“error while creating mount source path '/host_mnt/Users/username/xxxanythingllm/searxng/my-searxng/searxng': mkdir /host_mnt/Users/username/xxx: operation not permitted.”
2)測試SearXNG
部署完成,可以在瀏覽器訪問了,鏈接如下
http://127.0.0.1:8080
SearXNG默認不啟用bing和baidu,可以在如下鏈接頁面設置,找到bing和baidu并勾選。
http://127.0.0.1:8080/preferences
點擊右下角Save后就可以正常訪問了。
3)配置SearXNG
為了AnythingLLM 通過接口調用 SearXNG,需要SearXNG 支持返回?json
?格式數據,具體為修改?settings.yml
?文件,在?search.formats
?部分(大約在第 30?行),添加?- json
?配置項。
然后重啟SearXNG docker容器
docker restart <container-id>
重啟后,訪問如下鏈接看能否返回json數據。
http://127.0.0.1:8080/search?q=llm&format=json
正常情況應該返回如下數據
3?AnythingLLM+SearXNG
假設AnythingLLM和Ollama已安裝,考慮到mac m1受限算力,采用qwen3:4b小模型。
詳情請參考Mac M1探索AnythingLLM+Ollama+知識庫問答-CSDN博客
這里直接說明在AnythingLLM中配置SearXNG的過程。
1)AnythingLLM中配置SearXNG
如下圖所示,在AnythongLLM的WebSearch中選擇SearXNG,填寫BaseUrl,然后Save保存。
http://192.168.66.107:8080/search
不能用http://127.0.0.1:8080/search,必須填寫容器宿主機(安裝docker機器)的被分配真實ip。
AnythingLLM不能通過127.0.0.1定位到安裝在docker容器中的SearXNG。填寫宿主機真實IP,能確保SearXNG和AnythingLLM網絡互通,宿主機ip地址獲取參考附錄。
2)測試 SearXNG 生效
在AnythongLLM的agent聊天頁面,輸入
@agent 請你幫我搜索 QwQ大模型
agent沒有提示網絡失敗,所以AnythingLLM和SearXNG之間的網絡是通的。
AnythongLLM回答不太符合預期,與本地LLM處理能力有關,這里LLM Qwen3:4b是小模型。
附錄
---
mac m1 docker相關問題
1)container sharing問題
docker: Error response from daemon: error while creating mount source path '/host_mnt/Users/username/xxxanythingllm/searxng/my-searxng/searxng': mkdir /host_mnt/Users/username/xxx: operation not permitted.
方案: 將container的sharing從gRPC或virtualFS更改為osxfs
change the docker settings to use osxfs, instead of gRPC or Fuse.
https://github.com/docker/for-mac/issues/5390
2)容器ip獲取
登錄docker container機器,然后運行ifconfig
這里ip為172.17.0.2
3)宿主機ip獲取
在安裝docker容器的主機中,打開term,輸入ifconfig,獲取ip地址。
ifconfig
也可以通過其他方式獲取,如直接查看網絡連接,查看dockder軟件中的宿主機信息。
reference
---
searxng-docker
https://github.com/searxng/searxng-docker
searxng
https://github.com/searxng/searxng
AnythingLLM + SearXNG 實現私有搜索引擎代理
https://zhuanlan.zhihu.com/p/29294534050
docker install
https://docs.docker.com/desktop/setup/install/mac-install/
colima使用docker compose問題(mac)
https://blog.csdn.net/m0_38113882/article/details/131550044
目前國內可用Docker鏡像源匯總(截至2025年6月)
目前國內可用Docker鏡像源匯總(截至2025年6月) - CoderJia
MacOS安裝docker,并設置國內鏡像源
https://www.haveyb.com/article/3245
使用SearXNG-搭建個人搜索引擎(附國內可用Docker鏡像源)
https://blog.csdn.net/C_0010/article/details/143191038
host_mnt volume mount problem on Mac in the latest version with has reappeared?#5390
https://github.com/docker/for-mac/issues/5390