@@ -30,8 +30,6 @@ Install with apache
3030 https://httpd.apache.org/docs/trunk/mod/core.html#location
3131.. _uWSGI Apache support:
3232 https://uwsgi-docs.readthedocs.io/en/latest/Apache.html
33−.. _apache uwsgi:
34− https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi
3533.. _mod_proxy_uwsgi:
3634 https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi
3735
@@ -149,22 +147,6 @@ How this default intro site is configured, depends on the linux distribution
149147
150148 less /etc/httpd/conf.d/welcome.conf
151149
152−.. _The Debian Layout:
153−
154−The Debian Layout
155−=================
156−
157−Be aware that the Debian layout is quite different from the standard Apache
158−configuration. For details look at the README.Debian_
159−(``/usr/share/doc/apache2/README.Debian.gz``). Some commands you should know on
160−Debian:
161−
162−* :man:`apache2ctl`: Apache HTTP server control interface
163−* :man:`a2enmod`, :man:`a2dismod`: switch on/off modules
164−* :man:`a2enconf`, :man:`a2disconf`: switch on/off configurations
165−* :man:`a2ensite`, :man:`a2dissite`: switch on/off sites
166−
167−
168150.. _apache searx site:
169151
170152Apache Reverse Proxy
@@ -179,8 +161,12 @@ Apache Reverse Proxy
179161
180162To setup a Apache revers proxy you have to enable the *headers* and *proxy*
181163modules and create a `Location`_ configuration for the searx site. In most
182−distributions you have to uncomment the lines in the main configuration file,
183−except in the :ref:`The Debian Layout`.
164+distributions you have to un-comment the lines in the main configuration file,
165+except in :ref:`The Debian Layout`.
166+
167+To pass the HTTP HOST header
168+With ProxyPreserveHost_ the incoming Host HTTP request header is passed to the
169+proxied host.
184170
185171.. tabs::
186172
@@ -210,6 +196,8 @@ except in the :ref:`The Debian Layout`.
210196
211197 .. code:: apache
212198
199+ FIXME needs test
200+
213201 LoadModule headers_module modules/mod_headers.so
214202 LoadModule proxy_module modules/mod_proxy.so
215203 LoadModule proxy_http_module modules/mod_proxy_http.so
@@ -221,7 +209,9 @@ except in the :ref:`The Debian Layout`.
221209
222210 .. code:: apache
223211
224− LoadModule headers_module modules/mod_headers.so
212+ FIXME needs test
213+
214+ LoadModule headers_module modules/mod_headers.so
225215 LoadModule proxy_module modules/mod_proxy.so
226216 LoadModule proxy_http_module modules/mod_proxy_http.so
227217
@@ -256,8 +246,7 @@ except in the :ref:`The Debian Layout`.
256246 </Location>
257247
258248 2. Configure reverse proxy for :ref:`morty <searx morty>`, listening on
259− *localhost 3000* (FYI: ``ProxyPreserveHost On`` is already set, see
260− above):
249+ *localhost 3000*
261250
262251 .. code:: apache
263252
@@ -297,10 +286,9 @@ uWSGI support
297286=============
298287
299288Be warned, with this setup, your instance isn't :ref:`protected <searx
300−filtron>`. Nevertheless it is good enough for intranet usage and it
301−demonstrates: *how different the uwsgi support is, depending on the
302−distribution*. To enable :ref:`uWSGI <searx uwsgi>` support you need to install
303−the apache `apache uwsgi`_ support:
289+filtron>`, nevertheless it is good enough for intranet usage. In modern Linux
290+distributions, the `mod_proxy_uwsgi`_ is compiled into the *normal* apache
291+package and you need to install only the :ref:`uWSGI <searx uwsgi>` package:
304292
305293.. tabs::
306294
@@ -308,8 +296,10 @@ the apache `apache uwsgi`_ support:
308296
309297 .. code:: sh
310298
311− sudo -H apt-get install libapache2-mod-uwsgi
312− sudo -H a2enmod uwsgi
299+ sudo -H apt-get install uwsgi
300+
301+ # Ubuntu =< 18.04
302+ sudo -H apt-get install libapache2-mod-proxy-uwsgi
313303
314304 .. group-tab:: Arch Linux
315305
@@ -317,74 +307,88 @@ the apache `apache uwsgi`_ support:
317307
318308 sudo -H pacman -S uwsgi
319309
320− In the ``/etc/httpd/conf/httpd.conf`` file, activate headers and proxy
321− modules (LoadModule_):
322−
323− .. code:: apache
324−
325− LoadModule proxy_module modules/mod_proxy.so
326− LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
327−
328310 .. group-tab:: Fedora / RHEL
329311
330312 .. code:: sh
331313
332314 sudo -H dnf install uwsgi
333− FIXME: enable uwsgi in apache
334315
335316The next example shows a configuration using the `uWSGI Apache support`_ via
336−unix sockets. For socket communication, you have to activate ``socket =
337−/run/uwsgi/app/searx/socket`` and comment out the ``http = 127.0.0.1:8888``
338−configuration in your :ref:`uwsgi ini file <uwsgi configuration>`.
317+unix sockets and `mod_proxy_uwsgi`_.
339318
340−If not already exists, create a folder for the unix sockets, which can be
341−used by the searx account:
319+For socket communication, you have to activate ``socket =
320+/run/uwsgi/app/searx/socket`` and comment out the ``http = 127.0.0.1:8888``
321+configuration in your :ref:`uwsgi ini file <uwsgi configuration>`. If not
322+already exists, create a folder for the unix sockets, which can be used by the
323+searx account (see :ref:`create searx user`):
342324
343325.. code:: bash
344326
345327 sudo -H mkdir -p /run/uwsgi/app/searx/
346328 sudo -H chown -R searx:searx /run/uwsgi/app/searx/
347329
348−To limit acces to your intranet replace ``Allow from all`` directive and replace
349−``192.168.0.0/16`` with your subnet IP/class.
330+If the server is public; to limit access to your intranet replace ``Allow from
331+all`` directive and replace ``192.168.0.0/16`` with your subnet IP/class.
350332
351333.. tabs::
352334
353335 .. group-tab:: Ubuntu / debian
354336
355− Debian uses the (old) `mod_uwsgi
356− <https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-uwsgi>`_.
357−
358337 .. code:: apache
359338
360− <IfModule mod_uwsgi.c>
339+ LoadModule headers_module /usr/lib/apache2/mod_headers.so
340+ LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
341+ LoadModule proxy_uwsgi_module /usr/lib/apache2/modules/mod_proxy_uwsgi.so
361342
362− # SetEnvIf Request_URI "/searx" dontlog
363− # CustomLog /dev/null combined env=dontlog
343+ # SetEnvIf Request_URI /searx dontlog
344+ # CustomLog /dev/null combined env=dontlog
364345
365− <Location /searx >
346+ <Location /searx>
366347
367− Require all granted
348+ Require all granted
349+ Order deny,allow
350+ Deny from all
351+ # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
352+ Allow from all
368353
369− Options FollowSymLinks Indexes
370− SetHandler uwsgi-handler
371− uWSGISocket /run/uwsgi/app/searx/socket
354+ ProxyPreserveHost On
355+ ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
372356
373− Order deny,allow
374− Deny from all
375− # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
376− Allow from all
357+ </Location>
377358
378− </Location>
359+ .. group-tab:: Arch Linux
379360
380− </IfModule>
361+ .. code:: apache
381362
382− .. group-tab:: Arch Linux
363+ FIXME needs test
364+
365+ LoadModule proxy_module modules/mod_proxy.so
366+ LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
367+
368+ # SetEnvIf Request_URI /searx dontlog
369+ # CustomLog /dev/null combined env=dontlog
370+
371+ <Location /searx>
372+
373+ Require all granted
374+ Order deny,allow
375+ Deny from all
376+ # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
377+ Allow from all
378+
379+ ProxyPreserveHost On
380+ ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
383381
384− Arch Linux uses the (recommend) `mod_proxy_uwsgi`_.
382+ </Location>
383+
384+ .. group-tab:: Fedora / RHEL
385385
386386 .. code:: apache
387387
388+ FIXME needs test
389+
390+ LoadModule proxy_module modules/mod_proxy.so
391+ LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
388392 <IfModule proxy_uwsgi_module>
389393
390394 # SetEnvIf Request_URI /searx dontlog
@@ -405,29 +409,33 @@ To limit acces to your intranet replace ``Allow from all`` directive and replace
405409
406410 </IfModule>
407411
408− .. group-tab:: Fedora / RHEL
412+ .. group-tab:: old mod_wsgi
409413
410− RHEL uses the (recommend) `mod_proxy_uwsgi`_.
414+ We show this only for historical reasons, DON'T USE `mod_uwsgi
415+ <https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-uwsgi>`_.
416+ ANYMORE!
411417
412418 .. code:: apache
413419
414− <IfModule proxy_uwsgi_module>
420+ <IfModule mod_uwsgi.c>
415421
416− # SetEnvIf Request_URI /searx dontlog
422+ # SetEnvIf Request_URI "/searx" dontlog
417423 # CustomLog /dev/null combined env=dontlog
418424
419− <Location /searx>
425+ <Location /searx >
420426
421427 Require all granted
428+
429+ Options FollowSymLinks Indexes
430+ SetHandler uwsgi-handler
431+ uWSGISocket /run/uwsgi/app/searx/socket
432+
422433 Order deny,allow
423434 Deny from all
424435 # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
425436 Allow from all
426437
427− ProxyPreserveHost On
428− ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
429−
430− </Location>
438+ </Location>
431439
432440 </IfModule>
433441
@@ -473,3 +481,18 @@ one of the lines and `restart apache`_::
473481The ``CustomLog`` directive disable logs for the whole (virtual) server, use it
474482when the URL of the service does not have a path component (``/searx``) / is
475483located at root (``/``).
484+
485+.. _The Debian Layout:
486+
487+The Debian Layout
488+=================
489+
490+Be aware that the Debian layout is quite different from the standard Apache
491+configuration. For details look at the README.Debian_
492+(``/usr/share/doc/apache2/README.Debian.gz``). Some commands you should know on
493+Debian:
494+
495+* :man:`apache2ctl`: Apache HTTP server control interface
496+* :man:`a2enmod`, :man:`a2dismod`: switch on/off modules
497+* :man:`a2enconf`, :man:`a2disconf`: switch on/off configurations
498+* :man:`a2ensite`, :man:`a2dissite`: switch on/off sites