Skip to content

Install SearXNG on your Nginx server

1 min read

SearXNG is a metasearch engine that aggregates results from multiple search engines for better results and privacy.

Requirements

You need nginx and git installed on your server.

Installation

Clone and install:

cd ~/Downloads
git clone https://github.com/searxng/searxng.git searxng
cd searxng
sudo -H ./utils/searx.sh install all
sudo -H ./utils/filtron.sh install all

Configuration

Edit /etc/searxng/settings.yml:

server:
    secret_key: "<replace the key here>"
    image_proxy: true

engines:
    - name: google
      engine: google
      shortcut: go
      use_mobile_ui: true

Nginx setup

Create /etc/nginx/sites-available/searxng:

location /searx {
    proxy_pass         http://127.0.0.1:4004/;
    proxy_set_header   Host             $host;
    proxy_set_header   Connection       $http_connection;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header   X-Scheme         $scheme;
    proxy_set_header   X-Script-Name    /searx;

    access_log    off;
    error_log     off;
    log_not_found off;
}

location /searx/static/ {
    alias /usr/local/searx/searx-src/searx/static/;

    access_log    off;
    error_log     off;
    log_not_found off;
}

Include it in your server block:

server {
    ...
    include /etc/nginx/sites-available/searxng;
}

Verify and restart:

sudo nginx -t
sudo -H systemctl restart nginx
sudo -H service uwsgi restart searx

Inspect the service:

sudo -H ./utils/searx.sh inspect service