> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/ItzCrazyKns/Perplexica/llms.txt
> Use this file to discover all available pages before exploring further.

# SearxNG

> Configure SearxNG for web search functionality in Perplexica

Perplexica uses SearxNG as its search engine to retrieve web results while maintaining privacy. SearxNG is a privacy-respecting metasearch engine that aggregates results from multiple search engines.

## What is SearxNG?

SearxNG is a free, privacy-focused metasearch engine that:

* Aggregates results from multiple search engines (Google, Bing, DuckDuckGo, etc.)
* Does not track or profile users
* Provides JSON API for programmatic access
* Supports specialized search engines including Wolfram Alpha

## Default configuration

<Note>
  If you're using the standard Perplexica Docker image, SearxNG is included and pre-configured. No additional setup is required.
</Note>

When you run Perplexica with Docker:

```bash theme={null}
docker run -d -p 3000:3000 -v perplexica-data:/home/perplexica/data \
  --name perplexica itzcrazykns1337/perplexica:latest
```

The image includes:

* SearxNG running on port 8080 (internal)
* Pre-configured settings with JSON format enabled
* Wolfram Alpha search engine enabled
* Automatic startup with Perplexica

## Using your own SearxNG instance

If you already have a SearxNG instance running, use the slim Perplexica image:

```bash theme={null}
docker run -d -p 3000:3000 \
  -e SEARXNG_API_URL=http://your-searxng-url:8080 \
  -v perplexica-data:/home/perplexica/data \
  --name perplexica \
  itzcrazykns1337/perplexica:slim-latest
```

<ParamField path="SEARXNG_API_URL" type="string" required>
  The URL of your SearxNG instance

  **Example:** `http://localhost:8080`
</ParamField>

### Requirements for external SearxNG

<Warning>
  Your SearxNG instance must be properly configured for Perplexica to work correctly.
</Warning>

Ensure your SearxNG instance has:

<Steps>
  <Step title="JSON format enabled">
    Perplexica requires JSON API access. In your `settings.yml`:

    ```yaml theme={null}
    search:
      formats:
        - html
        - json
    ```
  </Step>

  <Step title="Wolfram Alpha enabled">
    Enable Wolfram Alpha for computational queries:

    ```yaml theme={null}
    engines:
      - name: wolframalpha
        disabled: false
    ```
  </Step>

  <Step title="Network accessibility">
    Ensure SearxNG is accessible from Perplexica:

    * If both run in Docker, use Docker networking
    * If Perplexica is in Docker and SearxNG is on host:
      * Windows/Mac: `http://host.docker.internal:8080`
      * Linux: `http://<host-ip>:8080`
  </Step>
</Steps>

## SearxNG configuration

The bundled SearxNG instance uses the following configuration:

### settings.yml

```yaml theme={null}
use_default_settings: true

general:
  instance_name: 'searxng'

search:
  autocomplete: 'google'
  formats:
    - html
    - json

server:
  secret_key: '<generated-secret>'

engines:
  - name: wolframalpha
    disabled: false
```

<Accordion title="Configuration details">
  * **use\_default\_settings**: Inherits SearxNG's default configuration
  * **autocomplete**: Uses Google for search suggestions
  * **formats**: Enables both HTML and JSON output
  * **wolframalpha**: Required for computational queries and calculations
</Accordion>

### Advanced configuration

If you're running your own SearxNG instance, you can customize:

<ParamField path="search.autocomplete" type="string">
  Autocomplete provider

  **Options:** `google`, `duckduckgo`, `wikipedia`, `dbpedia`, `qwant`

  **Default:** `google`
</ParamField>

<ParamField path="search.formats" type="array">
  Supported output formats

  **Required:** Must include `json` for Perplexica

  **Default:** `["html", "json"]`
</ParamField>

<ParamField path="engines" type="array">
  Enabled search engines

  **Required:** `wolframalpha` must be enabled

  You can add more engines from the SearxNG defaults
</ParamField>

## Setting up standalone SearxNG

To run SearxNG separately from Perplexica:

### Using Docker

<Steps>
  <Step title="Create settings.yml">
    Create a SearxNG configuration file:

    ```yaml theme={null}
    use_default_settings: true

    general:
      instance_name: 'searxng'

    search:
      autocomplete: 'google'
      formats:
        - html
        - json

    server:
      secret_key: '<generate-a-secret-key>'
      bind_address: '0.0.0.0'
      port: 8080

    engines:
      - name: wolframalpha
        disabled: false
    ```
  </Step>

  <Step title="Run SearxNG container">
    ```bash theme={null}
    docker run -d \
      -p 8080:8080 \
      -v $(pwd)/settings.yml:/etc/searxng/settings.yml \
      --name searxng \
      searxng/searxng:latest
    ```
  </Step>

  <Step title="Verify JSON format">
    Test that JSON API is working:

    ```bash theme={null}
    curl "http://localhost:8080/search?q=test&format=json"
    ```

    You should receive JSON-formatted search results.
  </Step>

  <Step title="Configure Perplexica">
    Set the SearxNG URL in Perplexica settings or via environment variable:

    ```bash theme={null}
    SEARXNG_API_URL=http://localhost:8080
    ```
  </Step>
</Steps>

### Manual installation

<Note>
  For manual installation, refer to the [official SearxNG documentation](https://docs.searxng.org/admin/installation.html).
</Note>

Basic steps:

1. Install SearxNG following the official guide
2. Configure `settings.yml` with JSON format and Wolfram Alpha enabled
3. Start SearxNG service
4. Configure Perplexica to use your SearxNG URL

## Configuring in Perplexica

You can set the SearxNG URL through:

### Settings UI

1. Navigate to Settings in Perplexica
2. Find the "Search" section
3. Enter your SearxNG URL in the "SearXNG URL" field
4. Save changes

### Environment variable

Set `SEARXNG_API_URL` before starting Perplexica:

```bash theme={null}
export SEARXNG_API_URL=http://localhost:8080
```

Or with Docker:

```bash theme={null}
docker run -d -p 3000:3000 \
  -e SEARXNG_API_URL=http://localhost:8080 \
  -v perplexica-data:/home/perplexica/data \
  --name perplexica \
  itzcrazykns1337/perplexica:slim-latest
```

## Troubleshooting

### SearxNG not responding

<Accordion title="Check SearxNG is running">
  Test the SearxNG endpoint:

  ```bash theme={null}
  curl http://localhost:8080
  ```

  You should see the SearxNG web interface HTML.
</Accordion>

<Accordion title="Verify JSON format">
  Ensure JSON format is enabled:

  ```bash theme={null}
  curl "http://localhost:8080/search?q=test&format=json"
  ```

  If you get an error about unsupported format, check your `settings.yml`.
</Accordion>

<Accordion title="Check network connectivity">
  From inside the Perplexica container:

  ```bash theme={null}
  docker exec -it perplexica curl http://localhost:8080
  ```

  If this fails, verify the URL configuration and Docker networking.
</Accordion>

### Wolfram Alpha not working

<Warning>
  Wolfram Alpha is required for computational queries and calculations. Without it, some search features may not work correctly.
</Warning>

Verify Wolfram Alpha is enabled in `settings.yml`:

```yaml theme={null}
engines:
  - name: wolframalpha
    disabled: false
```

### Connection refused errors

<Accordion title="Docker networking issues">
  If Perplexica can't reach SearxNG:

  * **Both in Docker**: Use Docker network or container names
  * **SearxNG on host**: Use `host.docker.internal` (Windows/Mac) or host IP (Linux)
  * **Different machines**: Ensure firewall allows connections
</Accordion>

## Performance tuning

For better performance with your own SearxNG instance:

<Tip>
  * Limit the number of search engines to reduce latency
  * Enable caching in SearxNG settings
  * Use a local Redis instance for SearxNG caching
  * Configure rate limiting to prevent overload
</Tip>

## Next steps

* [Configure LLM providers](/configuration/models-and-providers)
* [Environment variables reference](/configuration/environment-variables)
* [Application settings](/configuration/settings)
