knowledge-vault/sources/references/开发笔记/Docker/安裝Searxng.md

220 lines
4.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

##### 克隆项目
```bash
cd /data
git clone https://github.com/searxng/searxng-docker.git
12
```
##### []()配置docker-compose
本次安装不采用caddy容器做代理采用本地nginx做代理因此注释掉caddy容器内容。
```dockerfile
version: '3.7'
services:
# caddy:
# container_name: caddy
# image: caddy:2-alpine
# network_mode: host
# volumes:
# - ./Caddyfile:/etc/caddy/Caddyfile:ro
# - caddy-data:/data:rw
# - caddy-config:/config:rw
# environment:
# - SEARXNG_HOSTNAME=${SEARXNG_HOSTNAME:-http://localhost:80}
# - SEARXNG_TLS=${LETSENCRYPT_EMAIL:-internal}
# cap_drop:
# - ALL
# cap_add:
# - NET_BIND_SERVICE
# - DAC_OVERRIDE
redis:
container_name: redis
image: "redis:alpine"
command: redis-server --save "" --appendonly "no"
networks:
- searxng
tmpfs:
- /var/lib/redis
cap_drop:
- ALL
cap_add:
- SETGID
- SETUID
- DAC_OVERRIDE
searxng:
container_name: searxng
image: searxng/searxng:latest
networks:
- searxng
ports:
- "127.0.0.1:8080:8080"
volumes:
- ./searxng:/etc/searxng:rw
environment:
- SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
- DAC_OVERRIDE
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "1"
networks:
searxng:
ipam:
driver: default
volumes:
caddy-data:
caddy-config:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
```
##### []()配置env文件
```bash
cd /data/searxng-docker
vim .env
12
```
```bash
/data/searxng-docker
[root@racknerd-944314 searxng-docker]# cat .env
# By default listen on https://localhost
# To change this:
# * uncomment SEARXNG_HOSTNAME, and replace <host> by the SearXNG hostname
# * uncomment LETSENCRYPT_EMAIL, and replace <email> by your email (require to create a Let's Encrypt certificate)
SEARXNG_HOSTNAME=www.xxx.xx
# LETSENCRYPT_EMAIL=<email>
123456789
```
> 将SEARXNG_HOSTNAME修改为域名
##### []()配置settings.yml文件
```bash
cd /data/searxng-docker/searxng
1
```
###### []()生成secret\_key秘钥
```bash
sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml
1
```
###### []()解决打开域名“too many requests”
```bash
limiter: false
1
```
###### []()添加engines配置解决google引擎 “too many requests”
```yaml
engines:
- name: google
engine: google
shortcut: go
use_mobile_ui: true
- name: google images
engine: google_images
use_mobile_ui: true
- name: google news
engine: google_news
use_mobile_ui: true
- name: google videos
engine: google_videos
use_mobile_ui: true
- name: google scholar
engine: google_scholar
use_mobile_ui: true
- name: google play apps
engine: google_play_apps
use_mobile_ui: true
```
###### []()完整settings.yml文件配置
```yml
# see https://docs.searxng.org/admin/engines/settings.html#use-default-settings
use_default_settings: true
server:
# base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml
secret_key: "3af379c948a8dfc252bc57f115c08c2f1ef7eaeab44a079082a9edd92d3d34ae" # change this!
limiter: false # can be disabled for a private instance
image_proxy: true
ui:
static_use_hash: true
redis:
url: redis://redis:6379/0
engines:
- name: google
engine: google
shortcut: go
use_mobile_ui: true
- name: google images
engine: google_images
use_mobile_ui: true
- name: google news
engine: google_news
use_mobile_ui: true
- name: google videos
engine: google_videos
use_mobile_ui: true
- name: google scholar
engine: google_scholar
use_mobile_ui: true
- name: google play apps
engine: google_play_apps
use_mobile_ui: true
```
##### []()根据docker-compose生成容器
```bash
cd /data/searxng-docker/
docker-compose up -d
docker-compose stop searxng
docker-compose rm searxng
```