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,17 +34,154 @@ 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:
sudo -H pacman -S nginx-mainline
sudo -H systemctl enable nginx
sudo -H systemctl start nginx
.. group-tab:: Fedora / RHEL
.. code-block:: sh
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`_:
.. tabs::
.. group-tab:: Ubuntu / debian
.. code:: sh
less /etc/nginx/nginx.conf
there is a line including site configurations from:
.. code:: nginx
include /etc/nginx/sites-enabled/*;
.. group-tab:: Arch Linux
.. code-block:: sh
less /etc/nginx/nginx.conf
in there is a configuration section named ``server``:
.. code-block:: nginx
server {
listen 80;
server_name localhost;
# ...
}
.. group-tab:: Fedora / RHEL
.. code-block:: sh
less /etc/nginx/nginx.conf
there is a line including site configurations from:
.. code:: nginx
include /etc/nginx/conf.d/*.conf;
.. _nginx searx site:
A searx site
============
.. sidebar:: public to the internet?
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 .. code:: nginx
server { server {
listen 80; listen 80;
listen [::]:80;
# replace searx.example.com with your server's public name
server_name searx.example.com; server_name searx.example.com;
root /usr/local/searx/searx; root /usr/local/searx/searx;
location /static { location /static {
@ -47,28 +193,9 @@ content:
} }
} }
Create a symlink to sites-enabled: .. group-tab:: searx at ``/searx``
.. code:: sh Use this setup only, if your instance is **NOT** public to the internet:
sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
Restart service:
.. tabs::
.. group-tab:: Ubuntu / debian
.. code:: sh
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``:
.. code:: nginx .. code:: nginx
@ -83,8 +210,8 @@ Add this configuration in the server config file
} }
**OR** using reverse proxy (Please, note that reverse proxy advised to be used **OR** using reverse proxy. Please, note that reverse proxy advised to be
in case of single-user or low-traffic instances.) used in case of single-user or low-traffic instances.
.. code:: nginx .. code:: nginx
@ -101,11 +228,14 @@ in case of single-user or low-traffic instances.)
proxy_buffering off; proxy_buffering off;
} }
Enable ``base_url`` in ``searx/settings.yml`` Enable ``base_url`` in :origin:`searx/settings.yml`
.. code:: yaml .. code:: yaml
base_url : http://your.domain.tld/searx/ server:
# replace searx.example.com with your server's public name
base_url : http://searx.example.com/searx/
Restart service: Restart service:
@ -118,24 +248,31 @@ Restart service:
sudo -H systemctl restart nginx sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi sudo -H systemctl restart uwsgi
.. group-tab:: Arch Linux
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:
.. code:: nginx
access_log /dev/null;
error_log /dev/null;
Restart service:
.. tabs::
.. group-tab:: Ubuntu / debian
.. code:: sh .. code:: sh
sudo -H systemctl restart nginx 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