Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
6.5 KiB
Install with nginx
Contents
The nginx HTTP server
If nginx is not installed (uwsgi will not work with the package nginx-light) install it now.
Ubuntu / debian
sudo -H apt-get install nginx
Arch Linux
sudo -H pacman -S nginx-mainline
sudo -H systemctl enable nginx
sudo -H systemctl start nginx
Fedora / RHEL
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:
Ubuntu / debian
less /etc/nginx/nginx.conf
there is a line including site configurations from:
include /etc/nginx/sites-enabled/*;
Arch Linux
less /etc/nginx/nginx.conf
in there is a configuration section named server
:
server {
listen 80;
server_name localhost;
# ...
}
Fedora / RHEL
less /etc/nginx/nginx.conf
there is a line including site configurations from:
include /etc/nginx/conf.d/*.conf;
A searx site
public to the internet?
If your searx instance is public, stop here and first install filtron
reverse proxy <filtron.sh>
and result proxy morty <morty.sh>
, see installation scripts
.
Now you have to create a configuration for the searx 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.
Ubuntu / debian
Create configuration at /etc/nginx/sites-available/searx
and place a symlink to sites-enabled:
sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
Arch Linux
In the /etc/nginx/nginx.conf
file, replace the configuration section named server
.
Fedora / RHEL
Create configuration at /etc/nginx/conf.d/searx
and place a symlink to sites-enabled:
filtron at /
& /morty
Use this setup, if your instance is public to the internet:
location / {
proxy_set_header Host $http_host;
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_pass http://127.0.0.1:4004/;
}
location /morty {
proxy_set_header Host $http_host;
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_pass http://127.0.0.1:3000/;
}
For a fully result proxification add morty's <searx_morty>
public URL to your searx/settings.yml
:
result_proxy:
# replace searx.example.com with your server's public name
url : http://searx.example.com/
searx at /
Use this setup only, if your instance is NOT public to the internet:
server {
listen 80;
listen [::]:80;
# replace searx.example.com with your server's public name
server_name searx.example.com;
root /usr/local/searx/searx;
location /static {
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
}
}
searx at /searx
Use this setup only, if your instance is NOT public to the internet:
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
server:
# replace searx.example.com with your server's public name
base_url : http://searx.example.com/searx/
Restart service:
Ubuntu / debian
sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi
Arch Linux
sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi
Fedora
sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi
Disable logs
For better privacy you can disable nginx logs in /etc/nginx/nginx.conf
.
http {
# ...
access_log /dev/null;
error_log /dev/null;
# ...
}