Building a High-Speed Private Perplexity for Agencies Using SearXNG and Perplexica on Docker
Introduction: The Agency Dilemma in the Age of AI Search
In the fast-paced world of digital agencies, information is currency. Whether conducting deep market research, competitive analysis, or content ideation, teams rely heavily on AI-powered search engines like Perplexity AI. However, utilizing public AI search platforms introduces two significant challenges for enterprise environments: data privacy risks and escalating subscription costs.
When team members input sensitive client data, proprietary strategies, or unreleased product details into public LLMs, that data can potentially be used for model training. Furthermore, provisioning premium accounts for an entire agency can quickly bloat operational overhead. The solution? Building a self-hosted, private AI search engine. This comprehensive guide walks you through deploying a "Private Perplexity" for your agency using Perplexica and SearXNG, fully containerized via Docker.
Understanding the Architecture: Perplexica and SearXNG
Before diving into the technical deployment, it is essential to understand the core components of this architecture and how they interact to deliver localized, secure AI search capabilities.
What is Perplexica?
Perplexica is an open-source AI-powered search engine designed to replicate the functionality of Perplexity AI. It operates by taking a user query, searching the web, refining the results, and utilizing a Large Language Model (LLM) to synthesize a coherent, cited answer. It supports multiple search modes (e.g., General, Writing, Academic, YouTube) and can connect to various local or cloud-based LLM providers like Ollama, OpenAI, or Groq.
What is SearXNG?
SearXNG is a privacy-respecting, customizable metasearch engine. Instead of indexing the web itself, it aggregates search results from dozens of major search engines (Google, Bing, DuckDuckGo, etc.) simultaneously while stripping out tracking data. In our architecture, SearXNG acts as the localized data-retrieval backbone, ensuring Perplexica receives clean, comprehensive search results without relying on costly third-party search APIs.
Key Benefit: By pairing Perplexica with SearXNG, your agency gains complete control over both the search queries and the data synthesis layer, keeping all operations entirely within your private infrastructure.
Prerequisites and System Requirements
To ensure a smooth, high-speed deployment suitable for agency-wide concurrent use, your hosting environment should meet or exceed the following specifications:
- Operating System: Linux (Ubuntu 22.04 LTS or newer recommended) or a cloud instance (AWS EC2, DigitalOcean Droplet, Vultr).
- Hardware: Minimum 4 vCPUs, 8GB RAM, and 50GB SSD. Note: If you plan to run LLMs locally via Ollama on the same machine, a dedicated GPU (e.g., NVIDIA T4 or A10G) is highly recommended.
- Software: Docker Engine (v20.10+) and Docker Compose (v2.0+).
- Domain & Networking: A registered domain name and a reverse proxy (like Nginx Proxy Manager or Cloudflare Tunnels) for secure HTTPS access.
Step-by-Step Deployment Guide
Follow these structured steps to configure and launch your private AI search environment. We will deploy SearXNG and Perplexica together using a single Docker Compose network.
Step 1: Set Up the Project Directory
First, connect to your server via SSH and create a dedicated workspace directory for your deployment:
mkdir -p ~/private-perplexity/searxng
cd ~/private-perplexityStep 2: Configure SearXNG
SearXNG requires a configuration file to define its operational settings. Create the configuration file using your preferred text editor:
nano searxng/settings.ymlPaste the following optimized configuration into the file to ensure compatible output formats for Perplexica:
use_default_settings: true
server:
port: 8080
bind_address: "0.0.0.0"
secret_key: "super_secret_key_change_me"
search:
safe_search: 1
autocomplete: ""
formats:
- html
- jsonMake sure to replace "super_secret_key_change_me" with a unique, randomly generated hex string to secure your instance.
Step 3: Create the Docker Compose File
Now, create the master orchestration file that will launch both SearXNG and Perplexica as interconnected services:
nano docker-compose.ymlInsert the following configuration details into the file:
version: '3.8'
services:
searxng:
image: searxng/searxng:latest
container_name: searxng
volumes:
- ./searxng:/etc/searxng:ro
ports:
- "127.0.0.1:8080:8080"
networks:
- perplexica-net
restart: always
perplexica:
image: itzcrazybro/perplexica:latest
container_name: perplexica
ports:
- "3000:3000"
environment:
- SEARXNG_URL=http://searxng:8080
- NEXT_PUBLIC_API_URL=http://your-server-ip:3000/api
volumes:
- ./perplexica-data:/app/data
networks:
- perplexica-net
depends_on:
- searxng
restart: always
networks:
perplexica-net:
driver: bridgeImportant Note: Replace your-server-ip with the public IP address or domain name of your server so that the web interface can communicate successfully with the backend API.
Step 4: Initializing the Services
With all configuration files correctly mapped, execute the following command to download the images and spin up the containers in detached mode:
docker compose up -dTo verify that both services have launched successfully without errors, monitor the container logs:
docker compose logs -fConfiguring the Language Model (LLM) Integration
Once the containers are operational, access the Perplexica web interface by navigating to http://your-server-ip:3000 in your web browser. Upon your first visit, you will be prompted to configure your model preferences.
Perplexica offers flexible integration paths tailored to your agency's computational budget and privacy priorities:
- Cloud-Based APIs (Commercial Privacy): You can connect Perplexica directly to providers like OpenAI (GPT-4o), Groq (Llama 3), or Anthropic (Claude 3.5 Sonnet). While this routes data through external APIs, commercial API clauses generally guarantee your data will not be used for model training, offering a strong balance of high speed, intelligence, and basic data isolation.
- Fully Local/On-Premise (Absolute Privacy): For strict data residency requirements, install Ollama on an internal server equipped with GPUs. Pull models such as
llama3ormistral, and point Perplexica to your internal Ollama endpoint. This setup ensures that no data ever leaves your agency's network infrastructure.
Optimizing for Multi-User Agency Workflows
To successfully transition this standalone setup into a production-grade asset shared across multiple agency departments, consider implementing the following optimizations:
1. Implementing Reverse Proxy and HTTPS
Exposing raw ports is highly insecure. Deploy a reverse proxy like Nginx Proxy Manager or use Cloudflare Tunnels to route traffic through a secure domain (e.g., search.youragency.com) protected by an SSL/TLS certificate.
2. Access Control and Authentication
Since Perplexica lacks native multi-user authentication out of the box, you can safeguard your instance from unauthorized external access by layering a basic authentication system (such as HTTP Basic Auth via Nginx, Authelia, or Cloudflare Access) over the domain. This ensures only team members with valid credentials can utilize the search tool.
3. Speed and Caching Optimization
To maximize search retrieval speeds for your team, adjust the engine timeouts within the searxng/settings.yml file. Restricting search engine connections to high-speed providers and excluding historically slow websites will significantly minimize latency, allowing your private engine to match or exceed public web search speeds.
Conclusion: Future-Proofing Agency Insights
Deploying a private Perplexity instance using SearXNG and Perplexica on Docker represents a critical step forward in operational efficiency, cost management, and data sovereignty for modern agencies. By centralizing knowledge retrieval into a secure, shared ecosystem, your team can extract actionable intelligence faster while guaranteeing absolute confidentiality for client data. Embrace open-source AI infrastructure today to give your agency a secure, scalable competitive advantage.
