summaryrefslogtreecommitdiff
path: root/docs/admin/installation-nginx.rst
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2020-03-04 19:56:40 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2020-03-04 19:56:40 +0100
commitcbc08fdc26e96bf2cb02b76a30be095f5f60df9f (patch)
tree3d5104653f11015dfae7fa3d321e4bd90226efa6 /docs/admin/installation-nginx.rst
parent3aff2c19d16619d949dc52216b29ef637d1a44a1 (diff)
downloadsearxng-cbc08fdc26e96bf2cb02b76a30be095f5f60df9f.tar.gz
searxng-cbc08fdc26e96bf2cb02b76a30be095f5f60df9f.zip
docs: describe uwsgi setup of all suported distributions
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'docs/admin/installation-nginx.rst')
-rw-r--r--docs/admin/installation-nginx.rst277
1 files changed, 207 insertions, 70 deletions
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
- <filtron.sh>`).
+.. _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 <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 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 <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/
- 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;
+ # ...
+ }