Perplexica on a VPS: Self-Hosted AI Search Engine Backed by Local Models and Web Results
Perplexica is an open-source AI search engine — it combines web search (via SearXNG) with LLM synthesis to produce cited, comprehensive answers like Perplexity AI. Ask a question, Perplexica searches the web, extracts relevant content from top results, and synthesizes an answer with source citations. Self-hosted on a VPS with local Ollama models, searches are private and there are no per-query costs. Perplexity AI Pro costs $20/month.
Step 1: Docker Compose Setup
<code">mkdir -p /opt/perplexica && cd /opt/perplexica git clone https://github.com/ItzCrazyKns/Perplexica.git . # Configure: cp sample.config.toml config.toml nano config.toml
<code">[GENERAL] PORT = 3000 SIMILARITY_MEASURE = "cosine" [API_KEYS] # Optional cloud LLM providers (leave empty to use Ollama only) OPENAI = "" ANTHROPIC = "" [API_ENDPOINTS] # Your Ollama VPS endpoint (if Ollama is on same VPS, use internal URL) OLLAMA = "http://host.docker.internal:11434" # SearXNG is included in the docker-compose SEARXNG = "http://searxng:8080"
<code">nano docker-compose.yml
<code">version: '3.8'
services:
perplexica-backend:
build:
context: .
dockerfile: backend.dockerfile
container_name: perplexica-backend
restart: always
ports:
- "127.0.0.1:3001:3001"
volumes:
- ./config.toml:/home/perplexica/config.toml:ro
- ./uploads:/home/perplexica/uploads
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- searxng
perplexica-frontend:
build:
context: .
dockerfile: app.dockerfile
container_name: perplexica-frontend
restart: always
ports:
- "127.0.0.1:3000:3000"
environment:
NEXT_PUBLIC_API_URL: https://perplexica.yourdomain.com/api
NEXT_PUBLIC_WS_URL: wss://perplexica.yourdomain.com
searxng:
image: docker.io/searxng/searxng:latest
container_name: searxng
restart: always
volumes:
- ./searxng:/etc/searxng:rw
environment:
SEARXNG_BASE_URL: "http://searxng:8080/"
<code"># Configure SearXNG to allow JSON: mkdir -p searxng cat > searxng/settings.yml << 'EOF' server: secret_key: $(openssl rand -hex 32) search: formats: [html, json] EOF docker compose up -d --build
Step 2: Nginx Reverse Proxy
<code">sudo nano /etc/nginx/sites-available/perplexica
<code">server {
listen 443 ssl http2;
server_name perplexica.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/perplexica.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/perplexica.yourdomain.com/privkey.pem;
# Frontend
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Backend API and WebSocket
location /api {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_read_timeout 120s; # LLM inference can take time
proxy_buffering off; # Stream responses
}
}
<code">sudo certbot --nginx -d perplexica.yourdomain.com sudo systemctl reload nginx
Step 3: Configure LLM Models
<code"># In Perplexica UI → Settings (⚙️ icon): # Chat Model: # Provider: Ollama # Model: mistral (for general search) # or: llama3.2 (lighter, faster) # Embedding Model (for document search mode): # Provider: Ollama # Model: nomic-embed-text # Focus modes (different search strategies): # - Web Search: general web results # - Academic: research papers, arxiv # - YouTube: video search + transcript # - Wolfram Alpha: math/science queries # - Writing: no web search, just LLM
Step 4: Using Perplexica
<code"># Visit https://perplexica.yourdomain.com # Search examples: # "What are the latest developments in quantum computing?" # → Searches web → finds recent articles → synthesizes answer with citations # "Explain the Rust ownership model with examples" # → Combines web documentation + LLM explanation # "What is the current price of GPU servers for AI workloads?" # → Real-time web results → current pricing info # Upload a document and ask questions: # 📎 → upload PDF → "Summarize the key findings" # Focus mode: Academic # "Recent papers on RAG retrieval accuracy improvements" # → Searches arxiv, Google Scholar → cites papers
Step 5: API Usage
<code"># Perplexica exposes a REST API:
curl -X POST https://perplexica.yourdomain.com/api/search \
-H "Content-Type: application/json" \
-d '{
"query": "What is the current state of LLM benchmarks?",
"focusMode": "webSearch",
"optimizationMode": "balanced",
"chatModel": {
"provider": "ollama",
"model": "mistral"
},
"embeddingModel": {
"provider": "ollama",
"model": "nomic-embed-text"
}
}'
# Response includes:
# - message: synthesized answer
# - sources: [{title, url, content snippet}]
Getting Started
Perplexica with Ollama needs 4–8 GB RAM total (Ollama model + Perplexica services). A 8 GB Ubuntu VPS at VPS.DO runs the full stack with Mistral 7B. For OpenAI-backed searches (faster, better quality), a 2 GB VPS is sufficient since inference happens at OpenAI. The privacy benefit is significant — your search queries and the web content they retrieve never pass through Perplexity AI’s servers.
Conclusion
Self-hosted Perplexica provides Perplexity AI-style web search with AI synthesis — real-time web results combined with LLM understanding — using either local Ollama models for privacy or cloud APIs for quality. For teams conducting research, competitive analysis, or technical investigation, Perplexica’s cited answers are more verifiable than raw LLM responses and more synthesized than plain search engine results. At $0/month (beyond VPS cost) versus Perplexity AI Pro’s $20/month, self-hosted Perplexica is the obvious choice for privacy-conscious users.