Install with nginx


Install A nginx SearXNG site using filtron.sh

$ sudo -H ./utils/filtron.sh nginx install

Install A nginx SearXNG site using morty.sh

$ sudo -H ./utils/morty.sh nginx install

The nginx HTTP server

If nginx is not installed (uwsgi will not work with the package nginx-light), install it now.

sudo -H apt-get install nginx

Now at http://localhost you should see a Welcome to nginx! page, on Fedora you see a Fedora Webserver - Test Page. The test page comes from the default nginx server configuration. How this default intro site is configured, depends on the linux distribution:

less /etc/nginx/nginx.conf

there is a line including site configurations from:

include /etc/nginx/sites-enabled/*;

A nginx SearXNG site

Now you have to create a configuration for the SearXNG site. If nginx is new to you, the nginx beginners guide is a good starting point and the Getting Started wiki is always a good resource to keep in the pocket.

Create configuration at /etc/nginx/sites-available/searxng and place a symlink to sites-enabled:

sudo -H ln -s /etc/nginx/sites-available/searxng /etc/nginx/sites-enabled/searxng

Use this setup, if your instance is public to the internet, compare figure: architecture and Installation scripts.

  1. Configure a reverse proxy for filtron, listening on localhost 4004 (Route request through filtron):

# https://example.org/searx

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;
}

location /searx/static/ {
    alias /usr/local/searx/searx-src/searx/static/;
}
  1. Configure reverse proxy for morty, listening on localhost 3000:

# https://example.org/morty

location /morty {
    proxy_pass         http://127.0.0.1:3000/;

    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;
}

For a fully result proxification add morty’s public URL to your git://searx/settings.yml:

result_proxy:
    # replace example.org with your server's public name
    url : https://example.org/morty
    key : !!binary "insert_your_morty_proxy_key_here"

server:
    image_proxy : True

Restart service:

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

Disable logs

For better privacy you can disable nginx logs in /etc/nginx/nginx.conf.

http {
    # ...
    access_log /dev/null;
    error_log  /dev/null;
    # ...
}