on master help sign in
apache: normalize installation (docs and script)s over all distros

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commitee39a098acb2386abd5382de5c9476cc4ffe2e03 authorMarkus Heiser <markus.heiser@darmarit.de> dateTue 7 Apr 2020, 18:31 (7 years ago) parenteb0d464
13 files changed+264−171
docs/admin/installation-apache.rst+96−73 docs/admin/installation-searx.rst+2 utils/filtron.sh+3−5 utils/lib.sh+97−22 utils/lxc.sh+3−6 utils/makefile.include+3−1 utils/morty.sh+3−6 utils/searx.sh+13−17 utils/templates/etc/apache2+1 utils/templates/etc/apache2/sites-available/searx.conf:uwsgi−27 utils/templates/etc/apache2/sites-available/morty.conf → utils/templates/etc/httpd/sites-available/morty.conf+8−6 utils/templates/etc/apache2/sites-available/searx.conf:filtron → utils/templates/etc/httpd/sites-available/searx.conf:filtron+8−8 utils/templates/etc/httpd/sites-available/searx.conf:uwsgi+27
docs/admin/installation-apache.rst+96−73
@@ -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
docs/admin/installation-searx.rst+2
@@ -25,6 +25,8 @@ Install packages
2525
2626 This installs also the packages needed by :ref:`searx uwsgi`
2727
28+.. _create searx user:
29+
2830Create user
2931===========
3032
utils/filtron.sh+3−5
@@ -441,14 +441,12 @@ This installs a reverse proxy (ProxyPass) into apache site (${APACHE_FILTRON_SIT
441441
442442 ! apache_is_installed && err_msg "Apache is not installed."
443443
444− if ! ask_yn "Do you really want to continue?"; then
444+ if ! ask_yn "Do you really want to continue?" Yn; then
445445 return
446+ else
447+ install_apache
446448 fi
447449
448− a2enmod headers
449− a2enmod proxy
450− a2enmod proxy_http
451−
452450 echo
453451 apache_install_site --variant=filtron "${APACHE_FILTRON_SITE}"
454452
utils/lib.sh+97−22
@@ -627,21 +627,56 @@ EOF
627627# Apache
628628# ------
629629
630−# FIXME: Arch Linux & RHEL should be added
630+apache_distro_setup() {
631+ # shellcheck disable=SC2034
632+ case $DIST_ID-$DIST_VERS in
633+ ubuntu-*|debian-*)
634+ # debian uses the /etc/apache2 path, while other distros use
635+ # the apache default at /etc/httpd
636+ APACHE_SITES_AVAILABLE="/etc/apache2/sites-available"
637+ APACHE_SITES_ENABLED="/etc/apache2/sites-enabled"
638+ APACHE_MODULES="/usr/lib/apache2/modules"
639+ APACHE_PACKAGES="apache2"
640+ ;;
641+ arch-*)
642+ APACHE_SITES_AVAILABLE="/etc/httpd/sites-available"
643+ APACHE_SITES_ENABLED="/etc/httpd/sites-enabled"
644+ APACHE_MODULES="modules"
645+ APACHE_PACKAGES="apache"
646+ ;;
647+ fedora-*)
648+ APACHE_SITES_AVAILABLE="/etc/httpd/sites-available"
649+ APACHE_SITES_ENABLED="/etc/httpd/sites-enabled"
650+ APACHE_MODULES="modules"
651+ APACHE_PACKAGES="httpd"
652+ ;;
653+ *)
654+ err_msg "$DIST_ID-$DIST_VERS: apache not yet implemented"
655+ ;;
656+ esac
657+}
631658
632−if [[ -z "${APACHE_SITES_AVAILABE}" ]]; then
633− APACHE_SITES_AVAILABE="/etc/apache2/sites-available"
634−fi
659+apache_distro_setup
635660
636−apache_is_installed() {
661+install_apache(){
662+ info_msg "installing apache ..."
663+ pkg_install "$APACHE_PACKAGES"
637664 case $DIST_ID-$DIST_VERS in
638− ubuntu-*|debian-*)
639− (command -v apachectl \
640− && command -v a2ensite \
641− && command -v a2dissite ) &>/dev/null
665+ arch-*|fedora-*)
666+ if ! grep "IncludeOptional sites-enabled" "/etc/httpd/conf/httpd.conf"; then
667+ echo "IncludeOptional sites-enabled/*.conf" >> "/etc/httpd/conf/httpd.conf"
668+ fi
669+ systemctl enable httpd
670+ systemctl start httpd
642671 ;;
643− arch) (command -v httpd) ;;
644− fedora) (command -v httpd) ;;
672+ esac
673+}
674+
675+apache_is_installed() {
676+ case $DIST_ID-$DIST_VERS in
677+ ubuntu-*|debian-*) (command -v apachectl) &>/dev/null;;
678+ arch-*) (command -v httpd) &>/dev/null;;
679+ fedora-*) (command -v httpd) &>/dev/null;;
645680 esac
646681}
647682
@@ -649,8 +684,16 @@ apache_reload() {
649684
650685 info_msg "reload apache .."
651686 echo
652− sudo -H apachectl configtest
653− sudo -H service apache2 force-reload
687+ case $DIST_ID-$DIST_VERS in
688+ ubuntu-*|debian-*)
689+ sudo -H apachectl configtest
690+ sudo -H systemctl force-reload apache2
691+ ;;
692+ arch-*| fedora-*)
693+ sudo -H httpd -t
694+ sudo -H systemctl force-reload httpd
695+ ;;
696+ esac
654697}
655698
656699apache_install_site() {
@@ -670,9 +713,8 @@ apache_install_site() {
670713 done
671714
672715 install_template "${template_opts[@]}" \
673− "${APACHE_SITES_AVAILABE}/${pos_args[1]}" \
716+ "${APACHE_SITES_AVAILABLE}/${pos_args[1]}" \
674717 root root 644
675−
676718 apache_enable_site "${pos_args[1]}"
677719 info_msg "installed apache site: ${pos_args[1]}"
678720}
@@ -683,15 +725,32 @@ apache_remove_site() {
683725
684726 info_msg "remove apache site: $1"
685727 apache_dissable_site "$1"
686− rm -f "${APACHE_SITES_AVAILABE}/$1"
728+ rm -f "${APACHE_SITES_AVAILABLE}/$1"
687729}
688730
689731apache_enable_site() {
690732
691733 # usage: apache_enable_site <mysite.conf>
692734
693− info_msg "enable apache site: $1"
694− sudo -H a2ensite -q "$1"
735+ local CONF="$1"
736+
737+ info_msg "enable apache site: ${CONF}"
738+
739+ case $DIST_ID-$DIST_VERS in
740+ ubuntu-*|debian-*)
741+ sudo -H a2ensite -q "${CONF}"
742+ ;;
743+ arch-*)
744+ mkdir -p "${APACHE_SITES_ENABLED}"
745+ rm -f "${APACHE_SITES_ENABLED}/${CONF}"
746+ ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
747+ ;;
748+ fedora-*)
749+ mkdir -p "${APACHE_SITES_ENABLED}"
750+ rm -f "${APACHE_SITES_ENABLED}/${CONF}"
751+ ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
752+ ;;
753+ esac
695754 apache_reload
696755}
697756
@@ -699,9 +758,25 @@ apache_dissable_site() {
699758
700759 # usage: apache_disable_site <mysite.conf>
701760
702− info_msg "disable apache site: $1"
703− sudo -H a2dissite -q "$1"
704− apache_reload
761+ local CONF="$1"
762+
763+ info_msg "disable apache site: ${CONF}"
764+
765+ case $DIST_ID-$DIST_VERS in
766+ ubuntu-*|debian-*)
767+ sudo -H a2dissite -q "${CONF}"
768+ ;;
769+ arch-*)
770+ mkdir -p "${APACHE_SITES_ENABLED}"
771+ rm -f "${APACHE_SITES_ENABLED}/${CONF}"
772+ ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
773+ ;;
774+ fedora-*)
775+ mkdir -p "${APACHE_SITES_ENABLED}"
776+ rm -f "${APACHE_SITES_ENABLED}/${CONF}"
777+ ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
778+ ;;
779+ esac
705780}
706781
707782# uWSGI
@@ -741,7 +816,7 @@ uWSGI_distro_setup() {
741816 uWSGI_GROUP="uwsgi"
742817 ;;
743818 *)
744− info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
819+ err_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
745820 ;;
746821esac
747822}
utils/lxc.sh+3−6
@@ -98,7 +98,7 @@ start/stop
9898show
9999 :info: show info of all (or <name>) containers from LXC suite
100100 :config: show config of all (or <name>) containers from the LXC suite
101− :suite: show services of all the containers from the LXC suite
101+ :suite: show services of all (or <name>) containers from the LXC suite
102102 :images: show information of local images
103103cmd
104104 use single qoutes to evaluate in container's bash, e.g. 'echo $(hostname)'
@@ -294,11 +294,9 @@ main() {
294294
295295build_all_containers() {
296296 rst_title "Build all LXC containers of suite"
297+ echo
297298 usage_containers
298299 lxc_copy_images_localy
299− echo
300− rst_title "build containers" section
301− echo
302300 lxc_init_all_containers
303301 lxc_config_all_containers
304302 lxc_boilerplate_all_containers
@@ -368,7 +366,6 @@ remove_containers() {
368366
369367lxc_copy_images_localy() {
370368 rst_title "copy images" section
371− echo
372369 for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do
373370 lxc_image_copy "${LXC_SUITE[i]}" "${LXC_SUITE[i+1]}"
374371 done
@@ -477,7 +474,7 @@ lxc_init_all_containers() {
477474 local container_name
478475
479476 for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do
480− lxc_init_container "${LXC_SUITE[i+1]}" "${LXC_HOST_PREFIX}-${image_name}"
477+ lxc_init_container "${LXC_SUITE[i+1]}" "${LXC_HOST_PREFIX}-${LXC_SUITE[i+1]}"
481478 done
482479}
483480
utils/makefile.include+3−1
@@ -1,9 +1,11 @@
11# -*- coding: utf-8; mode: makefile-gmake -*-
22
33ifeq (,$(wildcard /.lxcenv.mk))
4−PHONY += lxc-activate
4+PHONY += lxc-activate lxc-purge
55lxc-activate:
66 @$(MAKE) -s -f /share/searx/utils/makefile.lxc lxc-activate
7+lxc-purge:
8+ $(Q)rm -rf ./lxc
79else
810 include /.lxcenv.mk
911endif
utils/morty.sh+3−6
@@ -402,15 +402,12 @@ This installs a reverse proxy (ProxyPass) into apache site (${APACHE_MORTY_SITE}
402402
403403 ! apache_is_installed && err_msg "Apache is not installed."
404404
405− if ! ask_yn "Do you really want to continue?"; then
405+ if ! ask_yn "Do you really want to continue?" Yn; then
406406 return
407+ else
408+ install_apache
407409 fi
408410
409− a2enmod headers
410− a2enmod proxy
411− a2enmod proxy_http
412−
413− echo
414411 apache_install_site "${APACHE_MORTY_SITE}"
415412
416413 info_msg "testing public url .."
utils/searx.sh+13−17
@@ -75,21 +75,23 @@ texlive-xetex-bin texlive-collection-fontsrecommended
7575texlive-collection-latex dejavu-sans-fonts dejavu-serif-fonts
7676dejavu-sans-mono-fonts"
7777
78−case $DIST_ID in
79− ubuntu|debian)
78+case $DIST_ID-$DIST_VERS in
79+ ubuntu-16.04|ubuntu-18.04)
8080 SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
8181 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
82− APACHE_PACKAGES="libapache2-mod-uwsgi"
82+ APACHE_PACKAGES="$APACHE_PACKAGES libapache2-mod-proxy-uwsgi"
8383 ;;
84− arch)
84+ ubuntu-*|debian-*)
85+ SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
86+ BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
87+ ;;
88+ arch-*)
8589 SEARX_PACKAGES="${SEARX_PACKAGES_arch}"
8690 BUILD_PACKAGES="${BUILD_PACKAGES_arch}"
87− APACHE_PACKAGES="uwsgi"
8891 ;;
89− fedora)
92+ fedora-*)
9093 SEARX_PACKAGES="${SEARX_PACKAGES_fedora}"
9194 BUILD_PACKAGES="${BUILD_PACKAGES_fedora}"
92− APACHE_PACKAGES="uwsgi"
9395 ;;
9496esac
9597
@@ -462,6 +464,7 @@ EOF
462464 wait_key
463465 info_msg "install needed python packages"
464466 tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
467+pip install wheel
465468${SEARX_SRC}/manage.sh update_packages
466469EOF
467470}
@@ -735,21 +738,14 @@ This installs the searx uwsgi app as apache site. If your server is public to
735738the internet, you should instead use a reverse proxy (filtron) to block
736739excessively bot queries."
737740
738− case $DIST_ID-$DIST_VERS in
739− ubuntu-*|debian-*) : ;;
740− *) err_msg "sorry distro $DIST_ID $DIST_VERS not yet supported"; exit 42 ;;
741− esac
742−
743741 ! apache_is_installed && err_msg "Apache is not installed."
744742
745− if ! ask_yn "Do you really want to install apache site for searx-uwsgi?"; then
743+ if ! ask_yn "Do you really want to continue?" Yn; then
746744 return
745+ else
746+ install_apache
747747 fi
748748
749− pkg_install "$APACHE_PACKAGES"
750− a2enmod uwsgi
751−
752− echo
753749 apache_install_site --variant=uwsgi "${APACHE_SEARX_SITE}"
754750
755751 if ! service_is_available "${PUBLIC_URL}"; then
utils/templates/etc/apache2new file+1
@@ -0,0 +1 @@
1+httpd
utils/templates/etc/apache2/sites-available/searx.conf:uwsgideleted−27
@@ -1,27 +0,0 @@
1−# -*- coding: utf-8; mode: apache -*-
2−
3−<IfModule mod_uwsgi.c>
4−
5− # SetEnvIf Request_URI "${SEARX_URL_PATH}" dontlog
6− # CustomLog /dev/null combined env=dontlog
7−
8− <Location ${SEARX_URL_PATH}>
9−
10− <IfModule mod_security2.c>
11− SecRuleEngine Off
12− </IfModule>
13−
14− Require all granted
15−
16− Options FollowSymLinks Indexes
17− SetHandler uwsgi-handler
18− uWSGISocket ${SEARX_UWSGI_SOCKET}
19−
20− Order deny,allow
21− Deny from all
22− # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
23− Allow from all
24−
25− </Location>
26−
27−</IfModule>
utils/templates/etc/apache2/sites-available/morty.conf → utils/templates/etc/httpd/sites-available/morty.confrenamed+8−6
@@ -1,6 +1,12 @@
11# -*- coding: utf-8; mode: apache -*-
22
3−ProxyPreserveHost On
3+LoadModule headers_module ${APACHE_MODULES}/mod_headers.so
4+LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so
5+LoadModule proxy_module ${APACHE_MODULES}/mod_proxy_http.so
6+#LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so
7+
8+# SetEnvIf Request_URI "${PUBLIC_URL_PATH_MORTY}" dontlog
9+# CustomLog /dev/null combined env=dontlog
410
511<Location ${PUBLIC_URL_PATH_MORTY} >
612
@@ -15,12 +21,8 @@ ProxyPreserveHost On
1521 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
1622 Allow from all
1723
24+ ProxyPreserveHost On
1825 ProxyPass http://${MORTY_LISTEN}
1926 RequestHeader set X-Script-Name ${PUBLIC_URL_PATH_MORTY}
2027
21− # In Apache it seems, that setting HTTP_HOST header directive here does have
22− # no effect. I needed to set 'ProxyPreserveHost On' (see above).
23−
24− # RequestHeader set Host ${PUBLIC_HOST}
25−
2628</Location>
utils/templates/etc/apache2/sites-available/searx.conf:filtron → utils/templates/etc/httpd/sites-available/searx.conf:filtronrenamed+8−8
@@ -1,6 +1,12 @@
11# -*- coding: utf-8; mode: apache -*-
22
3−ProxyPreserveHost On
3+LoadModule headers_module ${APACHE_MODULES}/mod_headers.so
4+LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so
5+LoadModule proxy_module ${APACHE_MODULES}/mod_proxy_http.so
6+#LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so
7+
8+# SetEnvIf Request_URI "${FILTRON_URL_PATH}" dontlog
9+# CustomLog /dev/null combined env=dontlog
410
511# SecRuleRemoveById 981054
612# SecRuleRemoveById 981059
@@ -20,14 +26,8 @@ ProxyPreserveHost On
2026 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
2127 Allow from all
2228
29+ ProxyPreserveHost On
2330 ProxyPass http://${FILTRON_LISTEN}
2431 RequestHeader set X-Script-Name ${FILTRON_URL_PATH}
2532
26− # In Apache it seems, that setting HTTP_HOST header directive here does have
27− # no effect. I needed to set 'ProxyPreserveHost On' (see above). HTTP_HOST
28− # (ProxyPreserveHost On) is needed by searx to render correct *Search URL*
29− # in the *Link* box and *saved preference*.
30−
31− # RequestHeader set Host ${PUBLIC_HOST}
32−
3333</Location>
utils/templates/etc/httpd/sites-available/searx.conf:uwsginew file+27
@@ -0,0 +1,27 @@
1+# -*- coding: utf-8; mode: apache -*-
2+
3+LoadModule headers_module ${APACHE_MODULES}/mod_headers.so
4+LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so
5+LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so
6+# LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so
7+
8+# SetEnvIf Request_URI "${SEARX_URL_PATH}" dontlog
9+# CustomLog /dev/null combined env=dontlog
10+
11+<Location ${SEARX_URL_PATH}>
12+
13+ <IfModule mod_security2.c>
14+ SecRuleEngine Off
15+ </IfModule>
16+
17+ Require all granted
18+
19+ Order deny,allow
20+ Deny from all
21+ # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
22+ Allow from all
23+
24+ ProxyPreserveHost On
25+ ProxyPass unix:${SEARX_UWSGI_SOCKET}|uwsgi://uwsgi-uds-searx/
26+
27+</Location>