searxng/docs/admin/installation-nginx.rst
Markus Heiser eedd63ccd5 docs: revision of the installation instructions
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2020-02-04 16:42:13 +01:00

2.7 KiB

Install with nginx

public HTTP servers

On public searx instances use an application firewall (filtron <filtron.sh>).

Contents

If nginx is not installed (uwsgi will not work with the package nginx-light):

Ubuntu / debian

sudo -H apt-get install nginx

Hosted at /

Create the configuration file /etc/nginx/sites-available/searx with this content:

server {
    listen 80;
    server_name searx.example.com;
    root /usr/local/searx/searx;

    location /static {
    }

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

Create a symlink to sites-enabled:

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

Restart service:

Ubuntu / debian

sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi

from subdirectory URL (/searx)

Add this configuration in the server config file /etc/nginx/sites-enabled/default:

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

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

OR using reverse proxy (Please, note that reverse proxy advised to be used in case of single-user or low-traffic instances.)

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

Enable base_url in searx/settings.yml

base_url : http://your.domain.tld/searx/

Restart service:

Ubuntu / debian

sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi

disable logs

For better privacy you can disable nginx logs about searx. How to proceed: below uwsgi_pass in /etc/nginx/sites-available/default add:

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

Restart service:

Ubuntu / debian

sudo -H systemctl restart nginx