1.. _installation apache:
7.. _Apache: https://httpd.apache.org/
9 https://cwiki.apache.org/confluence/display/HTTPD/DistrosDefaultLayout#DistrosDefaultLayout-Debian,Ubuntu(Apachehttpd2.x):
11 https://salsa.debian.org/apache-team/apache2/raw/master/debian/apache2.README.Debian
13 https://wiki.archlinux.org/index.php/Apache_HTTP_Server
15 https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-apache-http-server/index.html
17 https://httpd.apache.org/docs/trunk/mod/directives.html
19 https://httpd.apache.org/docs/current/en/getting-started.html
20.. _Terms Used to Describe Directives:
21 https://httpd.apache.org/docs/current/en/mod/directive-dict.html
22.. _Configuration Files:
23 https://httpd.apache.org/docs/current/en/configuring.html
24.. _ProxyPreserveHost: https://httpd.apache.org/docs/trunk/mod/mod_proxy.html#proxypreservehost
26 https://httpd.apache.org/docs/2.4/mod/mod_so.html#loadmodule
28 https://httpd.apache.org/docs/trunk/mod/core.html#documentroot
30 https://httpd.apache.org/docs/trunk/mod/core.html#location
31.. _uWSGI Apache support:
32 https://uwsgi-docs.readthedocs.io/en/latest/Apache.html
34 https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi
36.. sidebar:: further read
38 - `Apache Arch Linux`_
39 - `Apache Debian`_ and `README.Debian`_
41 - `Apache directives`_
50**Install** :ref:`apache searx site` using :ref:`filtron.sh <filtron.sh overview>`
54 $ sudo -H ./utils/filtron.sh apache install
56**Install** :ref:`apache searx site` using :ref:`morty.sh <morty.sh overview>`
60 $ sudo -H ./utils/morty.sh apache install
67If Apache_ is not installed, install it now. If apache_ is new to you, the
68`Getting Started`_, `Configuration Files`_ and `Terms Used to Describe
69Directives`_ documentation gives first orientation. There is also a list of
70`Apache directives`_ *to keep in the pocket*.
74 .. group-tab:: Ubuntu / debian
78 sudo -H apt-get install apache2
80 .. group-tab:: Arch Linux
84 sudo -H pacman -S apache
85 sudo -H systemctl enable httpd
86 sudo -H systemctl start http
88 .. group-tab:: Fedora / RHEL
92 sudo -H dnf install httpd
93 sudo -H systemctl enable httpd
94 sudo -H systemctl start httpd
96Now at http://localhost you should see any kind of *Welcome* or *Test* page.
97How this default intro site is configured, depends on the linux distribution
98(compare `Apache directives`_).
102 .. group-tab:: Ubuntu / debian
106 less /etc/apache2/sites-enabled/000-default.conf
108 In this file, there is a line setting the `DocumentRoot`_ directive:
112 DocumentRoot /var/www/html
114 And the *welcome* page is the HTML file at ``/var/www/html/index.html``.
116 .. group-tab:: Arch Linux
120 less /etc/httpd/conf/httpd.conf
122 In this file, there is a line setting the `DocumentRoot`_ directive:
126 DocumentRoot "/srv/http"
127 <Directory "/srv/http">
128 Options Indexes FollowSymLinks
133 The *welcome* page of Arch Linux is a page showing directory located at
134 ``DocumentRoot``. This is *directory* page is generated by the Module
135 `mod_autoindex <https://httpd.apache.org/docs/2.4/mod/mod_autoindex.html>`_:
139 LoadModule autoindex_module modules/mod_autoindex.so
141 Include conf/extra/httpd-autoindex.conf
143 .. group-tab:: Fedora / RHEL
147 less /etc/httpd/conf/httpd.conf
149 In this file, there is a line setting the ``DocumentRoot`` directive:
153 DocumentRoot "/var/www/html"
155 <Directory "/var/www">
161 On fresh installations, the ``/var/www`` is empty and the *default
162 welcome page* is shown, the configuration is located at::
164 less /etc/httpd/conf.d/welcome.conf
166.. _apache searx site:
171.. sidebar:: public to the internet?
173 If your searx instance is public, stop here and first install :ref:`filtron
174 reverse proxy <filtron.sh>` and :ref:`result proxy morty <morty.sh>`, see
175 :ref:`installation scripts`. If already done, follow setup: *searx via
178To setup a Apache revers proxy you have to enable the *headers* and *proxy*
179modules and create a `Location`_ configuration for the searx site. In most
180distributions you have to un-comment the lines in the main configuration file,
181except in :ref:`The Debian Layout`.
185 .. group-tab:: Ubuntu / debian
187 In the Apache setup, enable headers and proxy modules:
191 sudo -H a2enmod headers
192 sudo -H a2enmod proxy
193 sudo -H a2enmod proxy_http
195 In :ref:`The Debian Layout` you create a ``searx.conf`` with the
196 ``<Location /searx >`` directive and save this file in the *sites
197 available* folder at ``/etc/apache2/sites-available``. To enable the
198 ``searx.conf`` use :man:`a2ensite`:
202 sudo -H a2ensite searx.conf
204 .. group-tab:: Arch Linux
206 In the ``/etc/httpd/conf/httpd.conf`` file, activate headers and proxy
207 modules (LoadModule_):
213 LoadModule headers_module modules/mod_headers.so
214 LoadModule proxy_module modules/mod_proxy.so
215 LoadModule proxy_http_module modules/mod_proxy_http.so
217 .. group-tab:: Fedora / RHEL
219 In the ``/etc/httpd/conf/httpd.conf`` file, activate headers and proxy
220 modules (LoadModule_):
226 LoadModule headers_module modules/mod_headers.so
227 LoadModule proxy_module modules/mod_proxy.so
228 LoadModule proxy_http_module modules/mod_proxy_http.so
230With ProxyPreserveHost_ the incoming Host HTTP request header is passed to the
233.. _apache searx via filtron plus morty:
237 .. group-tab:: searx via filtron plus morty
239 Use this setup, if your instance is public to the internet, compare
240 figure: :ref:`architecture <arch public>` and :ref:`installation scripts`.
242 1. Configure a reverse proxy for :ref:`filtron <filtron.sh>`, listening on
243 *localhost 4004* (:ref:`filtron route request`):
249 # SetEnvIf Request_URI "/searx" dontlog
250 # CustomLog /dev/null combined env=dontlog
256 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
260 ProxyPass http://127.0.0.1:4004
261 RequestHeader set X-Script-Name /searx
265 2. Configure reverse proxy for :ref:`morty <searx morty>`, listening on
274 # SetEnvIf Request_URI "/morty" dontlog
275 # CustomLog /dev/null combined env=dontlog
281 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
284 ProxyPass http://127.0.0.1:3000
285 RequestHeader set X-Script-Name /morty
289 For a fully result proxification add :ref:`morty's <searx morty>` **public
290 URL** to your :origin:`searx/settings.yml`:
295 # replace example.org with your server's public name
296 url : https://example.org/morty
297 key : !!binary "insert_your_morty_proxy_key_here"
305Be warned, with this setup, your instance isn't :ref:`protected <searx
306filtron>`, nevertheless it is good enough for intranet usage. In modern Linux
307distributions, the `mod_proxy_uwsgi`_ is compiled into the *normal* apache
308package and you need to install only the :ref:`uWSGI <searx uwsgi>` package:
312 .. group-tab:: Ubuntu / debian
316 sudo -H apt-get install uwsgi
319 sudo -H apt-get install libapache2-mod-proxy-uwsgi
321 .. group-tab:: Arch Linux
325 sudo -H pacman -S uwsgi
327 .. group-tab:: Fedora / RHEL
331 sudo -H dnf install uwsgi
333The next example shows a configuration using the `uWSGI Apache support`_ via
334unix sockets and `mod_proxy_uwsgi`_.
336For socket communication, you have to activate ``socket =
337/run/uwsgi/app/searx/socket`` and comment out the ``http = 127.0.0.1:8888``
338configuration in your :ref:`uwsgi ini file <uwsgi configuration>`. If not
339already exists, create a folder for the unix sockets, which can be used by the
340searx account (see :ref:`create searx user`):
344 sudo -H mkdir -p /run/uwsgi/app/searx/
345 sudo -H chown -R searx:searx /run/uwsgi/app/searx/
347If the server is public; to limit access to your intranet replace ``Allow from
348all`` directive and replace ``192.168.0.0/16`` with your subnet IP/class.
352 .. group-tab:: Ubuntu / debian
356 LoadModule headers_module /usr/lib/apache2/mod_headers.so
357 LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
358 LoadModule proxy_uwsgi_module /usr/lib/apache2/modules/mod_proxy_uwsgi.so
360 # SetEnvIf Request_URI /searx dontlog
361 # CustomLog /dev/null combined env=dontlog
368 # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
372 ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
376 .. group-tab:: Arch Linux
382 LoadModule proxy_module modules/mod_proxy.so
383 LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
385 # SetEnvIf Request_URI /searx dontlog
386 # CustomLog /dev/null combined env=dontlog
393 # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
397 ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
401 .. group-tab:: Fedora / RHEL
407 LoadModule proxy_module modules/mod_proxy.so
408 LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
409 <IfModule proxy_uwsgi_module>
411 # SetEnvIf Request_URI /searx dontlog
412 # CustomLog /dev/null combined env=dontlog
419 # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
423 ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
429 .. group-tab:: old mod_wsgi
431 We show this only for historical reasons, DON'T USE `mod_uwsgi
432 <https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-uwsgi>`_.
437 <IfModule mod_uwsgi.c>
439 # SetEnvIf Request_URI "/searx" dontlog
440 # CustomLog /dev/null combined env=dontlog
446 Options FollowSymLinks Indexes
447 SetHandler uwsgi-handler
448 uWSGISocket /run/uwsgi/app/searx/socket
452 # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
466 .. group-tab:: Ubuntu / debian
470 sudo -H systemctl restart apache2
471 sudo -H service uwsgi restart searx
473 .. group-tab:: Arch Linux
477 sudo -H systemctl restart httpd
478 sudo -H systemctl restart uwsgi@searx
480 .. group-tab:: Fedora / RHEL
484 sudo -H systemctl restart httpd
485 sudo -H touch /etc/uwsgi.d/searx.ini
491For better privacy you can disable Apache logs. In the examples above activate
492one of the lines and `restart apache`_::
495 # SetEnvIf Request_URI "/searx" dontlog
496 # CustomLog /dev/null combined env=dontlog
498The ``CustomLog`` directive disable logs for the whole (virtual) server, use it
499when the URL of the service does not have a path component (``/searx``) / is
500located at root (``/``).
502.. _The Debian Layout:
507Be aware that the Debian layout is quite different from the standard Apache
508configuration. For details look at the README.Debian_
509(``/usr/share/doc/apache2/README.Debian.gz``). Some commands you should know on
512* :man:`apache2ctl`: Apache HTTP server control interface
513* :man:`a2enmod`, :man:`a2dismod`: switch on/off modules
514* :man:`a2enconf`, :man:`a2disconf`: switch on/off configurations
515* :man:`a2ensite`, :man:`a2dissite`: switch on/off sites
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list