mirror of
https://github.com/open-webui/docs
synced 2025-05-20 03:08:56 +00:00
Update web_search.md
This commit is contained in:
parent
83c87c2d93
commit
c3a0e83cc5
@ -19,7 +19,9 @@ This guide provides instructions on how to set up web search capabilities in Ope
|
||||
|
||||
To configure SearXNG optimally for use with Open WebUI, follow these steps:
|
||||
|
||||
#### Create a New Directory `searxng-docker`
|
||||
**Step 1: `git clone` SearXNG Docker and navigate to the folder:**
|
||||
|
||||
1. Create a New Directory `searxng-docker`
|
||||
|
||||
Clone the searxng-docker repository. This folder will contain your SearXNG configuration files. Refer to the [SearXNG documentation](https://docs.searxng.org/) for configuration instructions.
|
||||
|
||||
@ -27,21 +29,15 @@ To configure SearXNG optimally for use with Open WebUI, follow these steps:
|
||||
git clone https://github.com/searxng/searxng-docker.git
|
||||
```
|
||||
|
||||
#### Configure SearXNG
|
||||
|
||||
Navigate to the `searxng-docker` repository:
|
||||
|
||||
```bash
|
||||
cd searxng-docker
|
||||
```
|
||||
|
||||
Create a new `.env` file:
|
||||
**Step 2: Locate and and modify the `.env` file:**
|
||||
|
||||
```bash
|
||||
touch .env
|
||||
```
|
||||
|
||||
Add the following to the `.env` file:
|
||||
1. Uncomment `SEARXNG_HOSTNAME` from the `.env` file and set it accordingly:
|
||||
|
||||
```bash
|
||||
# By default listen on https://localhost
|
||||
@ -76,7 +72,7 @@ sed -i "s/127.0.0.1:8080/0.0.0.0:1337/"
|
||||
sudo chmod a+rwx searxng-docker/searxng
|
||||
```
|
||||
|
||||
**Step 5: Create a Less Restrictive `limiter.toml` File**
|
||||
**Step 5: Create a Non-Restrictive `limiter.toml` File**
|
||||
|
||||
5. Create a non-restrictive `searxng-docker/searxng/limiter.toml` config file:
|
||||
|
||||
@ -111,6 +107,10 @@ rm searxng-docker/searxng/settings.yml
|
||||
|
||||
**Step 7: Create a Fresh `settings.yml` File**
|
||||
|
||||
:::note
|
||||
On the first run, you must remove `cap_drop: - ALL` from the `docker-compose.yaml` file for the `searxng` service to successfully create `/etc/searxng/uwsgi`.ini. This is necessary because the `cap_drop: - ALL` directive removes all capabilities, including those required for the creation of the `uwsgi.ini` file. After the first run, you should re-add `cap_drop: - ALL` to the `docker-compose.yaml` file for security reasons.
|
||||
:::
|
||||
|
||||
7. Bring up the container momentarily to generate a fresh settings.yml file:
|
||||
|
||||
```bash
|
||||
@ -125,6 +125,21 @@ docker compose up -d ; sleep 10 ; docker compose down
|
||||
sed -i 's/formats: \[\"html\"\/]/formats: [\"html\", \"json\"]/' searxng-docker/searxng/settings.yml
|
||||
```
|
||||
|
||||
Generate a secret key for your SearXNG instance:
|
||||
|
||||
```bash
|
||||
sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml
|
||||
```
|
||||
|
||||
Windows users can use the following powershell script to generate the secret key:
|
||||
|
||||
```powershell
|
||||
$randomBytes = New-Object byte[] 32
|
||||
(New-Object Security.Cryptography.RNGCryptoServiceProvider).GetBytes($randomBytes)
|
||||
$secretKey = -join ($randomBytes | ForEach-Object { "{0:x2}" -f $_ })
|
||||
(Get-Content searxng/settings.yml) -replace 'ultrasecretkey', $secretKey | Set-Content searxng/settings.yml
|
||||
```
|
||||
|
||||
Update the port number in the `server` section to match the one you set earlier (in this case, `1337`):
|
||||
|
||||
```bash
|
||||
@ -137,8 +152,6 @@ Change the `bind_address` as desired:
|
||||
sed -i 's/bind_address: "0.0.0.0"/bind_address: "127.0.0.1"/' searxng-docker/searxng/settings.yml
|
||||
```
|
||||
|
||||
Now, copy the modified `searxng` folder to the same directory as your compose file.
|
||||
|
||||
#### Configuration Files
|
||||
|
||||
#### searxng-docker/searxng/settings.yml (Extract)
|
||||
@ -244,13 +257,13 @@ offload-threads = 4
|
||||
|
||||
</details>
|
||||
|
||||
## 2. Alternative Configuration
|
||||
## 2. Alternative Setup
|
||||
|
||||
Alternatively, if you don't want to modify the default configuration, you can simply create an empty `searxng-docker` folder and follow the rest of the setup instructions.
|
||||
|
||||
### Docker Compose Setup
|
||||
|
||||
Add the following to your `docker-compose.yaml` file:
|
||||
Add the following environment variables to your Open WebUI `docker-compose.yaml` file:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
@ -261,16 +274,27 @@ services:
|
||||
RAG_WEB_SEARCH_RESULT_COUNT: 3
|
||||
RAG_WEB_SEARCH_CONCURRENT_REQUESTS: 10
|
||||
SEARXNG_QUERY_URL: "http://searxng:1337/search?q=<query>"
|
||||
```
|
||||
|
||||
Create a `.env` file for SearXNG:
|
||||
```
|
||||
# SearXNG
|
||||
SEARXNG_HOSTNAME=localhost:1337/
|
||||
```
|
||||
|
||||
Next, add the following to SearXNG's `docker-compose.yaml` file:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
searxng:
|
||||
image: searxng/searxng:latest
|
||||
container_name: searxng
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
- ./searxng:/etc/searxng:rw
|
||||
image: searxng/searxng:latest
|
||||
ports:
|
||||
- "1337:8080"
|
||||
volumes:
|
||||
- ./searxng:/etc/searxng:rw
|
||||
env_file:
|
||||
- .env
|
||||
restart: unless-stopped
|
||||
cap_drop:
|
||||
- ALL
|
||||
@ -286,16 +310,20 @@ services:
|
||||
max-file: "1"
|
||||
```
|
||||
|
||||
Launch your updated stack with:
|
||||
Your stack is ready to be launched with:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
:::note
|
||||
On the first run, you must remove `cap_drop: - ALL` from the `docker-compose.yaml` file for the `searxng` service to successfully create `/etc/searxng/uwsgi`.ini. This is necessary because the `cap_drop: - ALL` directive removes all capabilities, including those required for the creation of the `uwsgi.ini` file. After the first run, you should re-add `cap_drop: - ALL` to the `docker-compose.yaml` file for security reasons.
|
||||
:::
|
||||
|
||||
Alternatively, you can run SearXNG directly using `docker run`:
|
||||
|
||||
```bash
|
||||
docker run --name searxng --env-file stack.env -v ./searxng:/etc/searxng:rw -p 1337:8080 --restart unless-stopped --cap-drop ALL --cap-add CHOWN --cap-add SETGID --cap-add SETUID --cap-add DAC_OVERRIDE --log-driver json-file --log-opt max-size=1m,max-file=1 searxng/searxng:latest
|
||||
docker run --name searxng --env-file .env -v ./searxng:/etc/searxng:rw -p 1337:8080 --restart unless-stopped --cap-drop ALL --cap-add CHOWN --cap-add SETGID --cap-add SETUID --cap-add DAC_OVERRIDE --log-driver json-file --log-opt max-size=1m,max-file=1 searxng/searxng:latest
|
||||
```
|
||||
|
||||
## 3. Confirm Connectivity
|
||||
@ -311,10 +339,14 @@ docker exec -it open-webui curl http://host.docker.internal:1337/search?q=this+i
|
||||
1. Navigate to: `Admin Panel` -> `Settings` -> `Web Search`
|
||||
2. Toggle `Enable Web Search`
|
||||
3. Set `Web Search Engine` from dropdown menu to `searxng`
|
||||
4. Set `Searxng Query URL` to either:
|
||||
* `http://searxng:1337/search?q=<query>` (using the container name and exposed port)
|
||||
* `http://host.docker.internal:1337/search?q=<query>` (using the `host.docker.internal` DNS name and the host port)
|
||||
**Do note the `/search?q=<query>` part is mandatory.**
|
||||
4. Set `Searxng Query URL` to one of the following examples:
|
||||
|
||||
* `http://searxng:1337/search?q=<query>` (using the container name and exposed port, suitable for Docker-based setups)
|
||||
* `http://host.docker.internal:1337/search?q=<query>` (using the `host.docker.internal` DNS name and the host port, suitable for Docker-based setups)
|
||||
* `http://<searxng.local>/search?q=<query>` (using a local domain name, suitable for local network access)
|
||||
* `https://<search.domain.com>/search?q=<query>` (using a custom domain name for a self-hosted SearXNG instance, suitable for public or private access)
|
||||
|
||||
**Do note the `/search?q=<query>` part is mandatory.**
|
||||
5. Adjust the `Search Result Count` and `Concurrent Requests` values accordingly
|
||||
6. Save changes
|
||||
|
||||
@ -362,7 +394,7 @@ Search the web ;-)
|
||||
|
||||
### Docker Compose Setup
|
||||
|
||||
Add the following to a file named `docker-compose.yaml`:
|
||||
Add the following environment variables to your Open WebUI `docker-compose.yaml` file:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
@ -387,7 +419,7 @@ services:
|
||||
|
||||
### Docker Compose Setup
|
||||
|
||||
Add the following to a file named `docker-compose.yaml`:
|
||||
Add the following environment variables to your Open WebUI `docker-compose.yaml` file:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
@ -450,7 +482,11 @@ Coming Soon
|
||||
|
||||
### Setup
|
||||
|
||||
No setup required! DuckDuckGo works out of the box in Open WebUI. Note that there is a possibility of your searches being rate limited.
|
||||
No setup is required to use DuckDuckGo API for Open WebUI's built in web search! DuckDuckGo works out of the box in Open WebUI.
|
||||
|
||||
:::note
|
||||
There is a possibility of your web searches being rate limited.
|
||||
:::
|
||||
|
||||
## Tavily API
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user