NGINX¶
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 searxng.sh:
$ sudo -H ./utils/searxng.sh 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
sudo -H pacman -S nginx-mainline
sudo -H systemctl enable nginx
sudo -H systemctl start nginx
sudo -H dnf install nginx
sudo -H systemctl enable nginx
sudo -H systemctl start 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/*;
less /etc/nginx/nginx.conf
There is a configuration section named server
:
server {
listen 80;
server_name localhost;
# ...
}
less /etc/nginx/nginx.conf
There is one line that includes site configurations from:
include /etc/nginx/conf.d/*.conf;
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.
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 \
/etc/nginx/sites-enabled/searxng.conf
In the /etc/nginx/nginx.conf
file, in the server
section add a
include
directive:
server {
# ...
include /etc/nginx/default.d/*.conf;
# ...
}
Create two folders, one for the available sites and one for the enabled sites:
mkdir -p /etc/nginx/default.d
mkdir -p /etc/nginx/default.apps-available
Create configuration at /etc/nginx/default.apps-available
and place a
symlink to default.d
:
sudo -H ln -s /etc/nginx/default.apps-available/searxng.conf \
/etc/nginx/default.d/searxng.conf
Create a folder for the available sites:
mkdir -p /etc/nginx/default.apps-available
Create configuration at /etc/nginx/default.apps-available
and place a
symlink to conf.d
:
sudo -H ln -s /etc/nginx/default.apps-available/searxng.conf \
/etc/nginx/conf.d/searxng.conf
Restart services:
sudo -H systemctl restart nginx
sudo -H service uwsgi restart searxng
sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi@searxng
sudo -H systemctl restart nginx
sudo -H touch /etc/uwsgi.d/searxng.ini
Disable logs¶
For better privacy you can disable nginx logs in /etc/nginx/nginx.conf
.
http {
# ...
access_log /dev/null;
error_log /dev/null;
# ...
}