Install SearXNG Private Search Engine on VPS

Install SearXNG Private Search Engine on VPS

June 2026 · 7 min read

SearXNG is a meta search engine that aggregates results from over 70 sources including Google, Bing, DuckDuckGo, Wikipedia and more — without sharing your personal information or tracking cookies with anyone. Deploy it on your VPS to use as a private search engine for your team or family. It's a fork of SearX with more active development and a modern user interface.

Install SearXNG Using Docker

The fastest method is to use Docker Compose, which the SearXNG team provides:

sudo apt update && sudo apt install docker.io docker-compose git -y
sudo systemctl enable --now docker

# Clone repo
cd /opt
sudo git clone https://github.com/searxng/searxng-docker searxng
cd searxng
# Edit domain in .env file
sudo nano .env
SEARXNG_HOSTNAME=search.yourdomain.com
[email protected]
# Generate secret key
sudo sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml

# Run SearXNG with Caddy (auto TLS)
sudo docker-compose up -d

Manual Installation (Without Docker)

# Create user
sudo useradd -r -s /usr/sbin/nologin searxng
sudo mkdir -p /usr/local/searxng
sudo chown searxng:searxng /usr/local/searxng

# Install dependencies
sudo apt install python3-dev python3-babel python3-venv -y
sudo -u searxng -H python3 -m venv /usr/local/searxng/venv

# Clone and install
sudo -u searxng git clone https://github.com/searxng/searxng /usr/local/searxng/src
sudo -u searxng /usr/local/searxng/venv/bin/pip install -e /usr/local/searxng/src

Configure SearXNG

sudo cp /usr/local/searxng/src/searx/settings.yml /etc/searxng/settings.yml
sudo nano /etc/searxng/settings.yml
general:
  debug: false
  instance_name: "My Private Search"
  contact_url: false

server:
  secret_key: "$(openssl rand -hex 32)"
  bind_address: "127.0.0.1"
  port: 8888
  base_url: "https://search.yourdomain.com"
  image_proxy: true

ui:
  default_locale: "en"
  query_in_title: true
  infinite_scroll: true

search:
  safe_search: 0
  autocomplete: "google"

Set Up Nginx + TLS

sudo nano /etc/nginx/sites-available/searxng
server {
    listen 443 ssl;
    server_name search.yourdomain.com;
    ssl_certificate /etc/letsencrypt/live/search.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/search.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:8888;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
server { listen 80; server_name search.yourdomain.com; return 301 https://$host$request_uri; }
sudo certbot --nginx -d search.yourdomain.com
sudo ln -s /etc/nginx/sites-available/searxng /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
Tip: If using the Docker version with Caddy, TLS is handled automatically — no need to configure Nginx separately. However, if you need to run a reverse proxy alongside other services on the same server, Nginx offers more flexibility.

Verify SearXNG is Working Correctly

# Test API directly
curl "https://search.yourdomain.com/search?q=test&format=json" | python3 -m json.tool

# Check Docker container
docker ps | grep searxng
docker logs searxng-searxng-1 | tail -20

# Check port
sudo ss -tulnp | grep 8888
Tip: SearXNG provides an API endpoint at /search?q=keyword&format=json which you can use to integrate with browser extensions or custom scripts immediately.

Common Issues & Troubleshooting

Search Results Missing (Engines Not Responding)

Your VPS IP may be rate-limited by search engines. Enable caching or reduce the number of engines used:

sudo nano /etc/searxng/settings.yml
# Disable problematic engines
engines:
  - name: google
    disabled: true  # If Google blocks the IP

# Enable Redis caching
redis:
  url: redis://localhost:6379/0

Error 429: Too Many Requests from Google

Google blocks datacenter IPs when search volume is high. Use alternative engines that don't have rate limits:

# Edit settings.yml and enable engines without rate limits, such as:
# - brave, qwant, mojeek, mwmbl
# Then restart
sudo docker-compose restart

SearXNG is Very Slow During Searches

Enable Redis caching to cache search results:

sudo apt install redis-server -y
sudo systemctl enable --now redis-server
# Add to settings.yml:
redis:
  url: redis://localhost:6379/0

UI Page Not Rendering (Static Files Missing)

# Docker version: check volume
docker exec searxng-searxng-1 ls /usr/local/searxng/src/searx/static/

# Manual install: verify nginx root
ls /usr/local/searxng/src/searx/static/

Frequently Asked Questions

How is SearXNG More Secure than Google?

SearXNG does not store search history, does not send fingerprint data, does not use tracking cookies, and the IP sent to search engines is your VPS IP — not your user's real IP. This prevents Google and other search engines from building a user profile.

Can I Use SearXNG as My Default Browser Search Engine?

Yes. Navigate to your SearXNG URL and add it as a search engine in your browser settings. Firefox natively supports the OpenSearch protocol that SearXNG uses, allowing you to add it as the default search engine in a single click.

Can I Set Up SearXNG as Private (Only Accessible with the URL)?

Yes. Add HTTP basic authentication in Nginx or limit access via IP whitelist in your nginx.conf:

location / {
    auth_basic "Private Search";
    auth_basic_user_file /etc/nginx/.htpasswd;
    proxy_pass http://127.0.0.1:8888;
}