Searxng a new service added
For those who don’t know what Searxng is, it is a meta-search engine which aggregates results from more than 70 search services, it is open source and enforces privacy on its users, if you want to learn more about the project checkout the following link
Deployment
If you are interested in hosting Searxng keep reading, you could find this post useful, I made it to remember how to do it again in case I have to. Before starting I’m assuming you already have a host machine running Archlinux with Nginx configured.
Installing and running Searxng
This step was done downloading the package from the AUR, you will have to install a couple more AUR dependecies to make it work.
After installing the AUR dependencies, I ran the following commands to install Searxng
$ git clone https://aur.archlinux.org/searxng-git.git
$ cd searxng-git
$ makepkg -si
Now searxng is installed, to launch it you must run uwsgi (it is kind of a web server for applications), luckily Searxng comes with a systemd template to launch uwsgi properly configured, the only thing you have to do is enabling and running the service using the command below:
$ systemctl enable --now uwsgi@emperor.service
And check if it worked:
$ curl --head --verbose localhost:8888
Until here you’ve just followed a normal searxng installation, if you just want to use it locally skip the Nginx and HTTPS setup and enjoy your app, however if you are planning to host an instance in your server keep reading.
Nginx setup
To make it visible in your host machine you must set a proxy in
Nginx configurations, in my case I created a new file in
/etc/nginx/sites-available
directory called searxng
with the following
contents:
1server {
2 # Listens on http
3
4 # Your server name
5 server_name searx.juanvalencia.xyz; # Use your domain here
6
7 # If you want to log user activity, comment these
8 access_log /dev/null;
9 error_log /dev/null;
10
11 # X-Frame-Options (XFO) header set to DENY
12 add_header X-Frame-Options "DENY";
13
14 # HTTP Strict Transport Security (HSTS) header
15 add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
16
17 # Content Security Policy (CSP)
18 add_header Content-Security-Policy "default-src 'self';";
19
20 location / {
21 proxy_pass http://127.0.0.1:8888;
22
23 proxy_set_header Host $host;
24 proxy_set_header Connection $http_connection;
25
26 # see flaskfix.py
27 proxy_set_header X-Scheme $scheme;
28 proxy_set_header X-Script-Name /searxng;
29
30 # see limiter.py
31 proxy_set_header X-Real-IP $remote_addr;
32 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
33 }
34}
To enabled the page I made a symbolic link in /etc/nginx/sites-enabled/
folder:
$ ln -s /etc/nginx/sites-available/searxng /etc/nginx/sites-enabled/searxng
To make the setup effective you have to reload the nginx
service as follows:
systemctl reload-or-restart nginx
HTTPS setup
Finally to set up the service using HTTPS
, we need to use certbot here is the
command to run generate the certificates:
$ certbot --nginx
Now you should have a Searxng Instance hosted on your domain.
Searxng Configurations
To configure Searxng edit /etc/searxng/settings.yml
file, and restart
uwsgi@emperor
Systemd service:
$ systemctl restart uwsgi@emperor.service
In this link you will find a useful reference.