docs: describe uwsgi setup of all suported distributions

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-03-04 19:56:40 +01:00
parent 3aff2c19d1
commit cbc08fdc26
6 changed files with 223 additions and 83 deletions

View file

@ -4,10 +4,11 @@
Install with apache Install with apache
=================== ===================
.. sidebar:: public HTTP servers .. sidebar:: public to the internet?
On public searx instances use an application firewall (:ref:`filtron If your searx instance is public, stop here and first install :ref:`filtron
<filtron.sh>`). reverse proxy <filtron.sh>` and :ref:`result proxy morty <morty.sh>`, see
:ref:`installation scripts`.
.. contents:: Contents .. contents:: Contents
:depth: 2 :depth: 2

View file

@ -4,18 +4,27 @@
Install with nginx Install with nginx
================== ==================
.. sidebar:: public HTTP servers .. _nginx:
https://docs.nginx.com/nginx/admin-guide/
On public searx instances use an application firewall (:ref:`filtron .. _nginx server configuration:
<filtron.sh>`). https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#setting-up-virtual-servers
.. _nginx beginners guide:
http://nginx.org/en/docs/beginners_guide.html
.. _Getting Started wiki:
https://www.nginx.com/resources/wiki/start/
.. contents:: Contents .. contents:: Contents
:depth: 2 :depth: 2
:local: :local:
:backlinks: entry :backlinks: entry
If nginx is not installed (uwsgi will not work with the package
nginx-light): The nginx HTTP server
=====================
If nginx_ is not installed (uwsgi will not work with the package nginx-light)
install it now.
.. tabs:: .. tabs::
@ -25,35 +34,25 @@ nginx-light):
sudo -H apt-get install nginx sudo -H apt-get install nginx
Hosted at ``/`` .. group-tab:: Arch Linux
===============
Create the configuration file ``/etc/nginx/sites-available/searx`` with this .. code-block:: sh
content:
.. code:: nginx sudo -H pacman -S nginx-mainline
sudo -H systemctl enable nginx
sudo -H systemctl start nginx
server { .. group-tab:: Fedora / RHEL
listen 80;
server_name searx.example.com;
root /usr/local/searx/searx;
location /static { .. code-block:: sh
}
location / { sudo -H dnf install nginx
include uwsgi_params; sudo -H systemctl enable nginx
uwsgi_pass unix:/run/uwsgi/app/searx/socket; sudo -H systemctl start nginx
}
}
Create a symlink to sites-enabled: 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
.. code:: sh `nginx server configuration`_:
sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
Restart service:
.. tabs:: .. tabs::
@ -61,74 +60,182 @@ Restart service:
.. code:: sh .. code:: sh
sudo -H systemctl restart nginx less /etc/nginx/nginx.conf
sudo -H systemctl restart uwsgi
from subdirectory URL (``/searx``) there is a line including site configurations from:
==================================
Add this configuration in the server config file .. code:: nginx
``/etc/nginx/sites-enabled/default``:
.. code:: nginx include /etc/nginx/sites-enabled/*;
location /searx/static { .. group-tab:: Arch Linux
alias /usr/local/searx/searx/static;
}
location /searx { .. code-block:: sh
uwsgi_param SCRIPT_NAME /searx;
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
}
less /etc/nginx/nginx.conf
**OR** using reverse proxy (Please, note that reverse proxy advised to be used in there is a configuration section named ``server``:
in case of single-user or low-traffic instances.)
.. code:: nginx .. code-block:: nginx
location /searx/static { server {
alias /usr/local/searx/searx/static; listen 80;
} server_name localhost;
# ...
}
location /searx { .. group-tab:: Fedora / RHEL
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`` .. code-block:: sh
.. code:: yaml less /etc/nginx/nginx.conf
base_url : http://your.domain.tld/searx/ there is a line including site configurations from:
Restart service: .. code:: nginx
.. tabs:: include /etc/nginx/conf.d/*.conf;
.. group-tab:: Ubuntu / debian .. _nginx searx site:
.. code:: sh A searx site
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: .. sidebar:: public to the internet?
below ``uwsgi_pass`` in ``/etc/nginx/sites-available/default`` add:
.. code:: nginx If your searx instance is public, stop here and first install :ref:`filtron
reverse proxy <filtron.sh>` and :ref:`result proxy morty <morty.sh>`, see
:ref:`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*.
.. tabs::
.. group-tab:: Ubuntu / debian
Create configuration at ``/etc/nginx/sites-available/searx`` and place a
symlink to sites-enabled:
.. code:: sh
sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
.. group-tab:: Arch Linux
In the ``/etc/nginx/nginx.conf`` file, replace the configuration section
named ``server``.
.. group-tab:: Fedora / RHEL
Create configuration at ``/etc/nginx/conf.d/searx`` and place a
symlink to sites-enabled:
.. tabs::
.. group-tab:: filtron at ``/`` & ``/morty``
Use this setup, if your instance is public to the internet:
.. code:: nginx
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/;
}
.. code:: nginx
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 :ref:`morty's <searx_morty>` public
URL to your :origin:`searx/settings.yml`:
.. code:: yaml
result_proxy:
# replace searx.example.com with your server's public name
url : http://searx.example.com/
.. group-tab:: searx at ``/``
Use this setup only, if your instance is **NOT** public to the internet:
.. code:: nginx
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;
}
}
.. group-tab:: searx at ``/searx``
Use this setup only, if your instance is **NOT** public to the internet:
.. code:: nginx
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.
.. code:: nginx
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 :origin:`searx/settings.yml`
.. code:: yaml
server:
# replace searx.example.com with your server's public name
base_url : http://searx.example.com/searx/
access_log /dev/null;
error_log /dev/null;
Restart service: Restart service:
@ -139,3 +246,33 @@ Restart service:
.. code:: sh .. code:: sh
sudo -H systemctl restart nginx sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi
.. group-tab:: Arch Linux
.. code:: sh
sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi
.. group-tab:: Fedora
.. code:: sh
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``.
.. code:: nginx
http {
# ...
access_log /dev/null;
error_log /dev/null;
# ...
}

View file

@ -7,7 +7,7 @@ Installation
*You're spoilt for choice*, choose your preferred method of installation. *You're spoilt for choice*, choose your preferred method of installation.
- :ref:`installation docker` - :ref:`installation docker`
- `Installation scripts`_ - :ref:`installation scripts`
- :ref:`installation basic` - :ref:`installation basic`
The :ref:`installation basic` is good enough for intranet usage and it is a The :ref:`installation basic` is good enough for intranet usage and it is a
@ -20,6 +20,7 @@ Therefore, if you do not have any special preferences, its recommend to use the
:ref:`installation docker` or the `Installation scripts`_ from our :ref:`tooling :ref:`installation docker` or the `Installation scripts`_ from our :ref:`tooling
box <toolboxing>` as described below. box <toolboxing>` as described below.
.. _installation scripts:
Installation scripts Installation scripts
==================== ====================

View file

@ -1,5 +1,5 @@
general: general:
debug : False # Debug mode, only for development debug : True # Debug mode, only for development
instance_name : "searx" # displayed name instance_name : "searx" # displayed name
search: search:

View file

@ -192,8 +192,9 @@ main() {
if [[ $exit_val -ne 0 ]]; then if [[ $exit_val -ne 0 ]]; then
warn_msg "[${_BBlue}${i}${_creset}] exit code (${_BRed}${exit_val}${_creset}) from ${_BGreen}${*}${_creset}" warn_msg "[${_BBlue}${i}${_creset}] exit code (${_BRed}${exit_val}${_creset}) from ${_BGreen}${*}${_creset}"
else else
info_msg "[${_BBlue}${i}${_creset}] exit code (${_BRed}${exit_val}${_creset}) from ${_BGreen}${*}${_creset}" info_msg "[${_BBlue}${i}${_creset}] exit code (${exit_val}) from ${_BGreen}${*}${_creset}"
fi fi
echo
done done
;; ;;
install) install)

View file

@ -668,7 +668,7 @@ enable: sudo -H ln -s ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP} ${uWSGI_APPS
start: sudo -H service uwsgi start ${SEARX_UWSGI_APP%.*} start: sudo -H service uwsgi start ${SEARX_UWSGI_APP%.*}
restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*} restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*}
stop: sudo -H service uwsgi stop ${SEARX_UWSGI_APP%.*} stop: sudo -H service uwsgi stop ${SEARX_UWSGI_APP%.*}
disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${CONF} disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP}
EOF EOF
;; ;;
arch-*) cat <<EOF arch-*) cat <<EOF