Searx

Runs at 10.1.1.4, not available publicly.

Setup

The setup is based on the official install documentation and the Python 3 page.

apt install git build-essential libxslt-dev python-dev python-virtualenv python-babel zlib1g-dev libffi-dev libssl-dev uwsgi uwsgi-plugin-python3 nginx

cd /usr/local
git clone https://github.com/asciimoo/searx.git
useradd searx -d /usr/local/searx
chown searx:searx -R /usr/local/searx

cd /usr/local/searx

sudo -H -u searx -i
virtualenv -p python3 venv3
. ./venv3/bin/activate
pip3 install -r requirements.txt
sudo -H mkdir -p /etc/searx
sudo -H cp /usr/local/searx/utils/templates/etc/searx/use_default_settings.yml /etc/searx/settings.yml
sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /etc/searx/settings.yml
sed -i -e "s/bind_address : \"127.0.0.1\"/bind_address : \"10.1.1.4\"/g" /etc/searx/settings.yml
# Test if everything works, then kill Searx.
python searx/webapp.py

# Exit back to regular root shell.
exit

# Use the config from below.
nano /etc/searx/settings.yml

# Paste Uwsgi config from below.
nano /etc/uwsgi/apps-available/searx.ini
ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/searx.ini

# Paste Uwsgi config from below.
nano /etc/nginx/sites-available/searx
ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx

service nginx restart && service uwsgi restart

Updates

Subscribe to the releases on GitHub.

This is based on the official update documentation.

cd /usr/local/searx
sudo -H -u searx -i
. ./venv3/bin/activate

git stash
git pull origin master
git stash apply
# Fix merge conflicts if necessary.

./manage.sh update_packages

# Exit back to regular root shell.
exit

sudo -H systemctl restart uwsgi

Configs

Uwsgi config

[uwsgi]
# Who will run the code
uid = searx
gid = searx

# disable logging for privacy
disable-logging = true

# Number of workers (usually CPU count)
workers = 4

# The right granted on the created socket
chmod-socket = 666

# Plugin to use and interpretor config
single-interpreter = true
master = true
plugin = python3
lazy-apps = true
enable-threads = true

# Module to import
module = searx.webapp

# Support running the module from a webserver subdirectory.
route-run = fixpathinfo:

# Virtualenv and python path
virtualenv = /usr/local/searx/venv3/
pythonpath = /usr/local/searx/
chdir = /usr/local/searx/searx/

Nginx config

server {
    listen 80;
    server_name 10.1.1.4;
    root /usr/local/searx/searx;

    access_log /dev/null;
    error_log /dev/null;

    location /static {
    }

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/app/searx/socket;
    }

    location /searx/static {
        alias /usr/local/searx/searx/static;
    }

    location /searx {
        proxy_pass http://127.0.0.1:8888;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Script-Name /searx;
        proxy_buffering off;
    }
}

Searx config

Fill in server.secret_key and the Flickr API key. Saved in /etc/searx/settings.yml.

# Adapted after: https://github.com/searx/searx/blob/002d53abf35192ba1094d7516da10b3442ca1f16/utils/templates/etc/searx/use_default_settings.yml
use_default_settings: True

general:
    debug : False # Debug mode, only for development
    instance_name : "searx.altpeter.me" # displayed name

search:
    safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
    autocomplete : "qwant" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default
    default_lang : "en" # Default search language - leave blank to detect from browser information or use codes from 'languages.py'

server:
    port : 8888
    bind_address : "10.1.1.4" # address to listen on
    secret_key : "key" # change this!
    base_url : "https://searx.altpeter.me" # Set custom base_url. Possible values: False or "https://your.custom.host/location/"
    image_proxy : True # Proxying image results through searx
    method: "GET"

ui:
    default_theme : oscar
    theme_args :
        oscar_style : logicodev-dark

outgoing: # communication with search engines
    request_timeout : 5.5 # default timeout in seconds, can be override by engine

engines:
    - name : bing
      engine : bing
      shortcut : bi
      disabled : True

    - name : bing images
      engine : bing_images
      shortcut : bii
      disabled : True

    - name : btdigg
      engine : btdigg
      shortcut : bt
      disabled : True

    - name : duckduckgo
      engine : duckduckgo
      shortcut : ddg
      disabled : False

    - name : duckduckgo images
      engine : duckduckgo_images
      shortcut : ddi
      timeout: 3.0
      disabled : False

    - name : flickr
      categories : images
      shortcut : fl
      engine : flickr
      api_key: 'key' # required!

    - name : google
      engine : google
      shortcut : go
      disabled : True

    - name : qwant
      engine : qwant
      shortcut : qw
      categories : general
      disabled : False

    - name : startpage
      engine : startpage
      shortcut : sp
      timeout : 6.0
      disabled : False

    - name : unsplash
      engine : unsplash
      disabled: False
      shortcut : us

If you want to change the config, do:

sudo -H -u searx nano /etc/searx/settings.yml
sudo -H systemctl restart uwsgi