This section explains how to set up a SearXNG instance using the HTTP server nginx. If you have used the Installation Script and do not have any special preferences you can install the SearXNG site using

$ sudo -H ./utils/ install nginx

If you have special interests or problems with setting up nginx, the following section might give you some guidance.

The nginx HTTP server

If nginx is not installed, 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 site is configured, depends on the linux distribution:

less /etc/nginx/nginx.conf

There is one line that includes site configurations from:

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

NGINX’s SearXNG site

Now you have to create a configuration file (searxng.conf) 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.

Depending on what your SearXNG installation is listening on, you need a http or socket communication to upstream.

location /searxng {

    uwsgi_pass unix:///usr/local/searxng/run/socket;

    include uwsgi_params;

    uwsgi_param    HTTP_HOST             $host;
    uwsgi_param    HTTP_CONNECTION       $http_connection;

    # see
    uwsgi_param    HTTP_X_SCHEME         $scheme;
    uwsgi_param    HTTP_X_SCRIPT_NAME    /searxng;

    # see
    uwsgi_param    HTTP_X_REAL_IP        $remote_addr;
    uwsgi_param    HTTP_X_FORWARDED_FOR  $proxy_add_x_forwarded_for;

# uWSGI serves the static files and in settings.yml we use::
#   ui:
#     static_use_hash: true
# location /searxng/static/ {
#     alias /usr/local/searxng/searxng-src/searx/static/;
# }

The Installation Script installs the reference setup and a uWSGI setup that listens on a socket by default.

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

sudo -H ln -s /etc/nginx/sites-available/searxng.conf \

Restart services:

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

Disable logs

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

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