From eedd63ccd504099836d9f528d02daffa6bc826ad Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 4 Feb 2020 16:42:13 +0100 Subject: docs: revision of the installation instructions Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 141 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 docs/admin/installation-nginx.rst (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst new file mode 100644 index 000000000..37d3e7532 --- /dev/null +++ b/docs/admin/installation-nginx.rst @@ -0,0 +1,141 @@ +.. _installation nginx: + +================== +Install with nginx +================== + +.. sidebar:: public HTTP servers + + On public searx instances use an application firewall (:ref:`filtron + `). + +.. contents:: Contents + :depth: 2 + :local: + :backlinks: entry + +If nginx is not installed (uwsgi will not work with the package +nginx-light): + +.. tabs:: + + .. group-tab:: Ubuntu / debian + + .. code:: sh + + sudo -H apt-get install nginx + +Hosted at ``/`` +=============== + +Create the configuration file ``/etc/nginx/sites-available/searx`` with this +content: + +.. code:: nginx + + server { + listen 80; + server_name searx.example.com; + root /usr/local/searx/searx; + + location /static { + } + + location / { + include uwsgi_params; + uwsgi_pass unix:/run/uwsgi/app/searx/socket; + } + } + +Create a symlink to sites-enabled: + +.. code:: sh + + 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 + + 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 ``searx/settings.yml`` + +.. code:: yaml + + base_url : http://your.domain.tld/searx/ + +Restart service: + +.. tabs:: + + .. group-tab:: Ubuntu / debian + + .. code:: sh + + 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: +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 + + sudo -H systemctl restart nginx -- cgit v1.2.3 From cbc08fdc26e96bf2cb02b76a30be095f5f60df9f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 4 Mar 2020 19:56:40 +0100 Subject: docs: describe uwsgi setup of all suported distributions Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 277 ++++++++++++++++++++++++++++---------- 1 file changed, 207 insertions(+), 70 deletions(-) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 37d3e7532..6cd815d1d 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -4,18 +4,27 @@ Install with nginx ================== -.. sidebar:: public HTTP servers - - On public searx instances use an application firewall (:ref:`filtron - `). +.. _nginx: + https://docs.nginx.com/nginx/admin-guide/ +.. _nginx server configuration: + 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 :depth: 2 :local: :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:: @@ -25,87 +34,208 @@ nginx-light): sudo -H apt-get install nginx -Hosted at ``/`` -=============== + .. group-tab:: Arch Linux -Create the configuration file ``/etc/nginx/sites-available/searx`` with this -content: + .. code-block:: sh -.. code:: nginx + sudo -H pacman -S nginx-mainline + sudo -H systemctl enable nginx + sudo -H systemctl start nginx - server { - listen 80; - server_name searx.example.com; - root /usr/local/searx/searx; + .. group-tab:: Fedora / RHEL - location /static { - } + .. code-block:: sh - location / { - include uwsgi_params; - uwsgi_pass unix:/run/uwsgi/app/searx/socket; - } - } + sudo -H dnf install nginx + sudo -H systemctl enable nginx + 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 +`nginx server configuration`_: -.. code:: sh +.. tabs:: - sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx + .. group-tab:: Ubuntu / debian -Restart service: + .. 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 ` and :ref:`result proxy morty `, 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 systemctl restart nginx - sudo -H systemctl restart uwsgi + sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx -from subdirectory URL (``/searx``) -================================== + .. group-tab:: Arch Linux -Add this configuration in the server config file -``/etc/nginx/sites-enabled/default``: + In the ``/etc/nginx/nginx.conf`` file, replace the configuration section + named ``server``. -.. code:: nginx + .. group-tab:: Fedora / RHEL - location /searx/static { - alias /usr/local/searx/searx/static; - } + Create configuration at ``/etc/nginx/conf.d/searx`` and place a + symlink to sites-enabled: - location /searx { - uwsgi_param SCRIPT_NAME /searx; - include uwsgi_params; - uwsgi_pass unix:/run/uwsgi/app/searx/socket; - } +.. tabs:: -**OR** using reverse proxy (Please, note that reverse proxy advised to be used -in case of single-user or low-traffic instances.) + .. group-tab:: filtron at ``/`` & ``/morty`` -.. code:: nginx + Use this setup, if your instance is public to the internet: - location /searx/static { - alias /usr/local/searx/searx/static; - } + .. code:: nginx - 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; - } + 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/; + } -Enable ``base_url`` in ``searx/settings.yml`` + .. code:: nginx -.. code:: yaml + 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 ` 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/ - base_url : http://your.domain.tld/searx/ Restart service: @@ -118,24 +248,31 @@ Restart service: sudo -H systemctl restart nginx sudo -H systemctl restart uwsgi + .. group-tab:: Arch Linux -disable logs -============ + .. code:: sh -For better privacy you can disable nginx logs about searx. How to proceed: -below ``uwsgi_pass`` in ``/etc/nginx/sites-available/default`` add: + sudo -H systemctl restart nginx + sudo -H systemctl restart uwsgi -.. code:: nginx + .. group-tab:: Fedora - access_log /dev/null; - error_log /dev/null; + .. code:: sh -Restart service: + sudo -H systemctl restart nginx + sudo -H systemctl restart uwsgi -.. tabs:: - .. group-tab:: Ubuntu / debian +Disable logs +============ - .. code:: sh +For better privacy you can disable nginx logs in ``/etc/nginx/nginx.conf``. - sudo -H systemctl restart nginx +.. code:: nginx + + http { + # ... + access_log /dev/null; + error_log /dev/null; + # ... + } -- cgit v1.2.3 From 387c6a77691fec514704bdf178b9ab94ad4abb40 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 6 Mar 2020 14:47:00 +0100 Subject: docs: improve description of uwsgi & ngingx setup Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 149 ++++++++++++++++++++++++++------------ 1 file changed, 103 insertions(+), 46 deletions(-) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 6cd815d1d..0b3ea022f 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -12,6 +12,12 @@ Install with nginx http://nginx.org/en/docs/beginners_guide.html .. _Getting Started wiki: https://www.nginx.com/resources/wiki/start/ +.. _uWSGI support from nginx: + https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html +.. _uwsgi_params: + https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#configuring-nginx +.. _SCRIPT_NAME: + https://werkzeug.palletsprojects.com/en/1.0.x/wsgi/#werkzeug.wsgi.get_script_name .. contents:: Contents :depth: 2 @@ -98,8 +104,8 @@ see a *Fedora Webserver - Test Page*. The test page comes from the default .. _nginx searx site: -A searx site -============ +A nginx searx site +================== .. sidebar:: public to the internet? @@ -134,33 +140,42 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. tabs:: + .. group-tab:: searx via filtron plus morty - .. group-tab:: filtron at ``/`` & ``/morty`` - - Use this setup, if your instance is public to the internet: + Use this setup, if your instance is public to the internet, compare + figure: :ref:`architecture `. Configure a reverse proxy for + :ref:`filtron `, listening on *localhost 4004* (:ref:`filtron + route request`): .. 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/; + + 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; } + + Configure reverse proxy for :ref:`morty `, listening on + *localhost 3000*: + .. 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/; + + 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; } - For a fully result proxification add :ref:`morty's ` public - URL to your :origin:`searx/settings.yml`: + Note that reverse proxy advised to be used in case of single-user or + low-traffic instances. For a fully result proxification add :ref:`morty's + ` **public URL** to your :origin:`searx/settings.yml`: .. code:: yaml @@ -169,66 +184,108 @@ Started wiki`_ is always a good resource *to keep in the pocket*. url : http://searx.example.com/ - .. group-tab:: searx at ``/`` + .. group-tab:: proxy or uWSGI - Use this setup only, if your instance is **NOT** public to the internet: + Be warned, with this setup, your Instance isn't :ref:`protected `. Nevertheless it is good enough for intranet usage and it is a + excellent example of; *how different services can be set up*. The next + example shows a reverse proxy configuration wrapping the :ref:`searx-uWSGI + application `, listening on ``http = + 127.0.0.1:8888``. .. code:: nginx - server { - listen 80; - listen [::]:80; + location / { + 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; + } + + Alternatively you can use the `uWSGI support from nginx`_ via unix + sockets. For socket communication, you have to activate ``socket = + /run/uwsgi/app/searx/socket`` and comment out the ``http = + 127.0.0.1:8888`` configuration in your :ref:`uwsgi ini file `. + + The example shows a nginx virtual ``server`` configuration, listening on + port 80 (IPv4 and IPv6 http://[::]:80). The uWSGI app is configured at + location ``/`` by importing the `uwsgi_params`_ and passing requests to + the uWSGI socket (``uwsgi_pass``). The ``server``\'s root points to the + :ref:`searx-src clone ` and wraps directly the + :origin:`searx/static/` content at ``location /static``. + + .. code:: nginx + + server { # replace searx.example.com with your server's public name server_name searx.example.com; - root /usr/local/searx/searx; - - location /static { - } + listen 80; + listen [::]:80; location / { include uwsgi_params; uwsgi_pass unix:/run/uwsgi/app/searx/socket; } + + root /usr/local/searx/searx-src/searx; + location /static { } } - .. group-tab:: searx at ``/searx`` + If not already exists, create a folder for the unix sockets, which can be + used by the searx account: - Use this setup only, if your instance is **NOT** public to the internet: + .. code:: bash - .. code:: nginx + mkdir -p /run/uwsgi/app/searx/ + sudo -H chown -R searx:searx /run/uwsgi/app/searx/ - location /searx/static { - alias /usr/local/searx/searx/static; - } + .. group-tab:: subdirectory URL + + Be warned, with these setups, your Instance isn't :ref:`protected `. The examples are just here to demonstrate how to export the + searx application from a subdirectory URL + http://searx.example.com/searx/\. + + .. code:: nginx location /searx { - uwsgi_param SCRIPT_NAME /searx; - include uwsgi_params; - uwsgi_pass unix:/run/uwsgi/app/searx/socket; + 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; } + location /searx/static { + alias /usr/local/searx/searx-src/searx/static; + } - **OR** using reverse proxy. Please, note that reverse proxy advised to be - used in case of single-user or low-traffic instances. + The ``X-Script-Name /searx`` is needed by the searx implementation to + calculate relative URLs correct. The next example shows a uWSGI + configuration. Since there are no HTTP headers in a (u)WSGI protocol, the + value is shipped via the SCRIPT_NAME_ in the WSGI environment. .. code:: nginx location /searx/static { - alias /usr/local/searx/searx/static; + alias /usr/local/searx/searx-src/searx; } 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; + uwsgi_param SCRIPT_NAME /searx; + include uwsgi_params; + uwsgi_pass unix:/run/uwsgi/app/searx/socket; } - Enable ``base_url`` in :origin:`searx/settings.yml` + For searx to work correctly the ``base_url`` must be set in the + :origin:`searx/settings.yml`. .. code:: yaml @@ -246,21 +303,21 @@ Restart service: .. code:: sh sudo -H systemctl restart nginx - sudo -H systemctl restart uwsgi + sudo -H service uwsgi restart searx .. group-tab:: Arch Linux .. code:: sh sudo -H systemctl restart nginx - sudo -H systemctl restart uwsgi + sudo -H systemctl restart uwsgi@searx .. group-tab:: Fedora .. code:: sh sudo -H systemctl restart nginx - sudo -H systemctl restart uwsgi + sudo -H touch /etc/uwsgi.d/searx.ini Disable logs -- cgit v1.2.3 From 857a1458b18476e18f1df9e338ba270c4ff2e35d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 6 Mar 2020 15:04:12 +0100 Subject: docs: for example URLs use iana's example.org Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 0b3ea022f..264bdacda 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -180,8 +180,8 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: yaml result_proxy: - # replace searx.example.com with your server's public name - url : http://searx.example.com/ + # replace example.org with your server's public name + url : https://example.org/ .. group-tab:: proxy or uWSGI @@ -221,8 +221,8 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: nginx server { - # replace searx.example.com with your server's public name - server_name searx.example.com; + # replace example.org with your server's public name + server_name example.org; listen 80; listen [::]:80; @@ -248,8 +248,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. Be warned, with these setups, your Instance isn't :ref:`protected `. The examples are just here to demonstrate how to export the - searx application from a subdirectory URL - http://searx.example.com/searx/\. + searx application from a subdirectory URL ``https://example.org/searx/``. .. code:: nginx @@ -290,8 +289,8 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: yaml server: - # replace searx.example.com with your server's public name - base_url : http://searx.example.com/searx/ + # replace example.org with your server's public name + base_url : https://example.org/searx/ Restart service: -- cgit v1.2.3 From c15337850e64562c376e5de57d8809a3a05b8a5d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 6 Mar 2020 22:06:19 +0100 Subject: fix: minor typos Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 264bdacda..2097d7daf 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -186,7 +186,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. group-tab:: proxy or uWSGI - Be warned, with this setup, your Instance isn't :ref:`protected `. Nevertheless it is good enough for intranet usage and it is a excellent example of; *how different services can be set up*. The next example shows a reverse proxy configuration wrapping the :ref:`searx-uWSGI @@ -246,7 +246,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. group-tab:: subdirectory URL - Be warned, with these setups, your Instance isn't :ref:`protected `. The examples are just here to demonstrate how to export the searx application from a subdirectory URL ``https://example.org/searx/``. -- cgit v1.2.3 From eb0d4646d818fe12032379aae2fcd8b5bdb6467e Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 6 Apr 2020 17:59:06 +0200 Subject: docs: rework of chapter "Install with apache" BTW: normalize installation-nginx.rst --- docs/admin/installation-nginx.rst | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 2097d7daf..b02c555f6 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -28,10 +28,9 @@ Install with nginx The nginx HTTP server ===================== -If nginx_ is not installed (uwsgi will not work with the package nginx-light) +If nginx_ is not installed (uwsgi will not work with the package nginx-light), install it now. - .. tabs:: .. group-tab:: Ubuntu / debian @@ -58,7 +57,8 @@ install it now. 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`_: +`nginx server configuration`_. How this default intro site is configured, +depends on the linux distribution: .. tabs:: @@ -111,7 +111,8 @@ A nginx searx site If your searx instance is public, stop here and first install :ref:`filtron reverse proxy ` and :ref:`result proxy morty `, see - :ref:`installation scripts`. + :ref:`installation scripts`. If already done, follow setup: *searx via + filtron plus morty*. 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 @@ -143,9 +144,10 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. group-tab:: searx via filtron plus morty Use this setup, if your instance is public to the internet, compare - figure: :ref:`architecture `. Configure a reverse proxy for - :ref:`filtron `, listening on *localhost 4004* (:ref:`filtron - route request`): + figure: :ref:`architecture ` and :ref:`installation scripts`. + + 1. Configure a reverse proxy for :ref:`filtron `, listening on + *localhost 4004* (:ref:`filtron route request`): .. code:: nginx @@ -159,8 +161,8 @@ Started wiki`_ is always a good resource *to keep in the pocket*. } - Configure reverse proxy for :ref:`morty `, listening on - *localhost 3000*: + 2. Configure reverse proxy for :ref:`morty `, listening on + *localhost 3000*: .. code:: nginx @@ -181,7 +183,10 @@ Started wiki`_ is always a good resource *to keep in the pocket*. result_proxy: # replace example.org with your server's public name - url : https://example.org/ + url : https://example.org/morty + + server: + image_proxy : True .. group-tab:: proxy or uWSGI @@ -244,7 +249,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. mkdir -p /run/uwsgi/app/searx/ sudo -H chown -R searx:searx /run/uwsgi/app/searx/ - .. group-tab:: subdirectory URL + .. group-tab:: proxy at subdir URL Be warned, with these setups, your instance isn't :ref:`protected `. The examples are just here to demonstrate how to export the -- cgit v1.2.3 From ebde9d10fd84de74ea99385dae4d95bcf932bcf3 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 9 Apr 2020 15:04:23 +0200 Subject: docs: proofreading of all the installation topics Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index b02c555f6..e62c60df6 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -19,6 +19,14 @@ Install with nginx .. _SCRIPT_NAME: https://werkzeug.palletsprojects.com/en/1.0.x/wsgi/#werkzeug.wsgi.get_script_name +.. sidebar:: further reading + + - nginx_ + - `nginx beginners guide`_ + - `nginx server configuration`_ + - `Getting Started wiki`_ + - `uWSGI support from nginx`_ + .. contents:: Contents :depth: 2 :local: -- cgit v1.2.3 From 58d5da8b57c5aeab92f551e8d175be67537c351c Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 11 Apr 2020 13:19:11 +0200 Subject: nginx: normalize installation (docs and script)s over all distros This is the revision of the documentation about the varous nginx installation variants. It also implements the nginx installation scripts for morty and filtron. Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 102 ++++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 42 deletions(-) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index e62c60df6..4ecc54066 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -159,14 +159,22 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: nginx - location / { - proxy_pass http://127.0.0.1:4004/; + # https://example.org/searx - 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; - } + location /searx { + proxy_pass http://127.0.0.1:4004/; + + proxy_set_header Host $http_host; + proxy_set_header Connection $http_connection; + 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_set_header X-Script-Name /searx; + } + + location /searx/static { + /usr/local/searx/searx-src/searx/static; + } 2. Configure reverse proxy for :ref:`morty `, listening on @@ -174,10 +182,13 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: nginx - location /morty { + # https://example.org/morty + + location /morty { proxy_pass http://127.0.0.1:3000/; proxy_set_header Host $http_host; + proxy_set_header Connection $http_connection; 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; @@ -197,7 +208,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. image_proxy : True - .. group-tab:: proxy or uWSGI + .. group-tab:: proxy or uWSGI Be warned, with this setup, your instance isn't :ref:`protected `. Nevertheless it is good enough for intranet usage and it is a @@ -208,15 +219,17 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: nginx - location / { - proxy_pass http://127.0.0.1:8888; + # https://hostname.local/ - 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; - } + location / { + proxy_pass http://127.0.0.1:8888; + + proxy_set_header Host $host; + proxy_set_header Connection $http_connection; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + proxy_buffering off; + } Alternatively you can use the `uWSGI support from nginx`_ via unix sockets. For socket communication, you have to activate ``socket = @@ -234,8 +247,8 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: nginx server { - # replace example.org with your server's public name - server_name example.org; + # replace hostname.local with your server's name + server_name hostname.local; listen 80; listen [::]:80; @@ -245,7 +258,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. uwsgi_pass unix:/run/uwsgi/app/searx/socket; } - root /usr/local/searx/searx-src/searx; + root /usr/local/searx/searx-src/searx; location /static { } } @@ -254,10 +267,10 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: bash - mkdir -p /run/uwsgi/app/searx/ - sudo -H chown -R searx:searx /run/uwsgi/app/searx/ + mkdir -p /run/uwsgi/app/searx/ + sudo -H chown -R searx:searx /run/uwsgi/app/searx/ - .. group-tab:: proxy at subdir URL + .. group-tab:: \.\. at subdir URL Be warned, with these setups, your instance isn't :ref:`protected `. The examples are just here to demonstrate how to export the @@ -265,19 +278,22 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: nginx - location /searx { - proxy_pass http://127.0.0.1:8888; + # https://hostname.local/searx - 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; - } + location /searx { + proxy_pass http://127.0.0.1:8888; + + proxy_set_header Host $host; + proxy_set_header Connection $http_connection; + 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; + } - location /searx/static { - alias /usr/local/searx/searx-src/searx/static; - } + location /searx/static { + alias /usr/local/searx/searx-src/searx/static; + } The ``X-Script-Name /searx`` is needed by the searx implementation to calculate relative URLs correct. The next example shows a uWSGI @@ -286,15 +302,17 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. code:: nginx - location /searx/static { - alias /usr/local/searx/searx-src/searx; - } + # https://hostname.local/searx + + location /searx { + uwsgi_param SCRIPT_NAME /searx; + include uwsgi_params; + uwsgi_pass unix:/run/uwsgi/app/searx/socket; + } - location /searx { - uwsgi_param SCRIPT_NAME /searx; - include uwsgi_params; - uwsgi_pass unix:/run/uwsgi/app/searx/socket; - } + location /searx/static { + alias /usr/local/searx/searx-src/searx; + } For searx to work correctly the ``base_url`` must be set in the :origin:`searx/settings.yml`. -- cgit v1.2.3 From 30c0a0fb641f2248829a3ccc3fd6abe58a55c77f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 13 Apr 2020 13:00:03 +0200 Subject: doc: add missing command lines to nginx docs Signed-off-by: Markus Heiser --- docs/admin/installation-nginx.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'docs/admin/installation-nginx.rst') diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 4ecc54066..5e32d9684 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -32,6 +32,22 @@ Install with nginx :local: :backlinks: entry +---- + +**Install** :ref:`nginx searx site` using :ref:`filtron.sh ` + +.. code:: bash + + $ sudo -H ./utils/filtron.sh nginx install + +**Install** :ref:`nginx searx site` using :ref:`morty.sh ` + +.. code:: bash + + $ sudo -H ./utils/morty.sh nginx install + +---- + The nginx HTTP server ===================== -- cgit v1.2.3