on master help sign in
apache: normalize installation (docs and script)s over all distros
ee39a09Markus Heiser
docs/admin/installation-apache.rst+96−73
@@ -30,8 +30,6 @@ Install with apache
30 https://httpd.apache.org/docs/trunk/mod/core.html#location
30 https://httpd.apache.org/docs/trunk/mod/core.html#location
31.. _uWSGI Apache support:
31.. _uWSGI Apache support:
32 https://uwsgi-docs.readthedocs.io/en/latest/Apache.html
32 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
35.. _mod_proxy_uwsgi:
33.. _mod_proxy_uwsgi:
36 https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi
34 https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi
37
35
@@ -149,22 +147,6 @@ How this default intro site is configured, depends on the linux distribution
149
147
150 less /etc/httpd/conf.d/welcome.conf
148 less /etc/httpd/conf.d/welcome.conf
151
149
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−
168.. _apache searx site:
150.. _apache searx site:
169
151
170Apache Reverse Proxy
152Apache Reverse Proxy
@@ -179,8 +161,12 @@ Apache Reverse Proxy
179
161
180To setup a Apache revers proxy you have to enable the *headers* and *proxy*
162To setup a Apache revers proxy you have to enable the *headers* and *proxy*
181modules and create a `Location`_ configuration for the searx site. In most
163modules and create a `Location`_ configuration for the searx site. In most
182−distributions you have to uncomment the lines in the main configuration file,
164+distributions you have to un-comment the lines in the main configuration file,
183−except in the :ref:`The Debian Layout`.
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.
184
170
185.. tabs::
171.. tabs::
186
172
@@ -210,6 +196,8 @@ except in the :ref:`The Debian Layout`.
210
196
211 .. code:: apache
197 .. code:: apache
212
198
199+ FIXME needs test
200+
213 LoadModule headers_module modules/mod_headers.so
201 LoadModule headers_module modules/mod_headers.so
214 LoadModule proxy_module modules/mod_proxy.so
202 LoadModule proxy_module modules/mod_proxy.so
215 LoadModule proxy_http_module modules/mod_proxy_http.so
203 LoadModule proxy_http_module modules/mod_proxy_http.so
@@ -221,7 +209,9 @@ except in the :ref:`The Debian Layout`.
221
209
222 .. code:: apache
210 .. code:: apache
223
211
212+ FIXME needs test
213+
224− LoadModule headers_module modules/mod_headers.so
214+ LoadModule headers_module modules/mod_headers.so
225 LoadModule proxy_module modules/mod_proxy.so
215 LoadModule proxy_module modules/mod_proxy.so
226 LoadModule proxy_http_module modules/mod_proxy_http.so
216 LoadModule proxy_http_module modules/mod_proxy_http.so
227
217
@@ -256,8 +246,7 @@ except in the :ref:`The Debian Layout`.
256 </Location>
246 </Location>
257
247
258 2. Configure reverse proxy for :ref:`morty <searx morty>`, listening on
248 2. Configure reverse proxy for :ref:`morty <searx morty>`, listening on
259− *localhost 3000* (FYI: ``ProxyPreserveHost On`` is already set, see
249+ *localhost 3000*
260− above):
261
250
262 .. code:: apache
251 .. code:: apache
263
252
@@ -297,10 +286,9 @@ uWSGI support
297=============
286=============
298
287
299Be warned, with this setup, your instance isn't :ref:`protected <searx
288Be warned, with this setup, your instance isn't :ref:`protected <searx
300−filtron>`. Nevertheless it is good enough for intranet usage and it
289+filtron>`, nevertheless it is good enough for intranet usage. In modern Linux
301−demonstrates: *how different the uwsgi support is, depending on the
290+distributions, the `mod_proxy_uwsgi`_ is compiled into the *normal* apache
302−distribution*. To enable :ref:`uWSGI <searx uwsgi>` support you need to install
291+package and you need to install only the :ref:`uWSGI <searx uwsgi>` package:
303−the apache `apache uwsgi`_ support:
304
292
305.. tabs::
293.. tabs::
306
294
@@ -308,8 +296,10 @@ the apache `apache uwsgi`_ support:
308
296
309 .. code:: sh
297 .. code:: sh
310
298
311− sudo -H apt-get install libapache2-mod-uwsgi
299+ sudo -H apt-get install uwsgi
312− sudo -H a2enmod uwsgi
300+
301+ # Ubuntu =< 18.04
302+ sudo -H apt-get install libapache2-mod-proxy-uwsgi
313
303
314 .. group-tab:: Arch Linux
304 .. group-tab:: Arch Linux
315
305
@@ -317,74 +307,88 @@ the apache `apache uwsgi`_ support:
317
307
318 sudo -H pacman -S uwsgi
308 sudo -H pacman -S uwsgi
319
309
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−
328 .. group-tab:: Fedora / RHEL
310 .. group-tab:: Fedora / RHEL
329
311
330 .. code:: sh
312 .. code:: sh
331
313
332 sudo -H dnf install uwsgi
314 sudo -H dnf install uwsgi
333− FIXME: enable uwsgi in apache
334
315
335The next example shows a configuration using the `uWSGI Apache support`_ via
316The next example shows a configuration using the `uWSGI Apache support`_ via
336−unix sockets. For socket communication, you have to activate ``socket =
317+unix sockets and `mod_proxy_uwsgi`_.
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>`.
339
318
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
340−If not already exists, create a folder for the unix sockets, which can be
322+already exists, create a folder for the unix sockets, which can be used by the
341−used by the searx account:
323+searx account (see :ref:`create searx user`):
342
324
343.. code:: bash
325.. code:: bash
344
326
345 sudo -H mkdir -p /run/uwsgi/app/searx/
327 sudo -H mkdir -p /run/uwsgi/app/searx/
346 sudo -H chown -R searx:searx /run/uwsgi/app/searx/
328 sudo -H chown -R searx:searx /run/uwsgi/app/searx/
347
329
348−To limit acces to your intranet replace ``Allow from all`` directive and replace
330+If the server is public; to limit access to your intranet replace ``Allow from
349−``192.168.0.0/16`` with your subnet IP/class.
331+all`` directive and replace ``192.168.0.0/16`` with your subnet IP/class.
350
332
351.. tabs::
333.. tabs::
352
334
353 .. group-tab:: Ubuntu / debian
335 .. group-tab:: Ubuntu / debian
354
336
355− Debian uses the (old) `mod_uwsgi
356− <https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-uwsgi>`_.
357−
358 .. code:: apache
337 .. code:: apache
359
338
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
361
342
362− # SetEnvIf Request_URI "/searx" dontlog
343+ # SetEnvIf Request_URI /searx dontlog
363− # CustomLog /dev/null combined env=dontlog
344+ # CustomLog /dev/null combined env=dontlog
364
345
365− <Location /searx >
346+ <Location /searx>
366
347
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
368
353
369− Options FollowSymLinks Indexes
354+ ProxyPreserveHost On
370− SetHandler uwsgi-handler
371− uWSGISocket /run/uwsgi/app/searx/socket
355+ ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
372
356
373− Order deny,allow
357+ </Location>
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
377
358
378− </Location>
359+ .. group-tab:: Arch Linux
379
360
380− </IfModule>
361+ .. code:: apache
381
362
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/
383
381
384− Arch Linux uses the (recommend) `mod_proxy_uwsgi`_.
382+ </Location>
383+
384+ .. group-tab:: Fedora / RHEL
385
385
386 .. code:: apache
386 .. code:: apache
387
387
388+ FIXME needs test
389+
390+ LoadModule proxy_module modules/mod_proxy.so
391+ LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
388 <IfModule proxy_uwsgi_module>
392 <IfModule proxy_uwsgi_module>
389
393
390 # SetEnvIf Request_URI /searx dontlog
394 # SetEnvIf Request_URI /searx dontlog
@@ -405,29 +409,33 @@ To limit acces to your intranet replace ``Allow from all`` directive and replace
405
409
406 </IfModule>
410 </IfModule>
407
411
408− .. group-tab:: Fedora / RHEL
412+ .. group-tab:: old mod_wsgi
409
413
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!
411
417
412 .. code:: apache
418 .. code:: apache
413
419
414− <IfModule proxy_uwsgi_module>
420+ <IfModule mod_uwsgi.c>
415
421
416− # SetEnvIf Request_URI /searx dontlog
422+ # SetEnvIf Request_URI "/searx" dontlog
417 # CustomLog /dev/null combined env=dontlog
423 # CustomLog /dev/null combined env=dontlog
418
424
419− <Location /searx>
425+ <Location /searx >
420
426
421 Require all granted
427 Require all granted
428+
429+ Options FollowSymLinks Indexes
430+ SetHandler uwsgi-handler
431+ uWSGISocket /run/uwsgi/app/searx/socket
432+
422 Order deny,allow
433 Order deny,allow
423 Deny from all
434 Deny from all
424 # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
435 # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
425 Allow from all
436 Allow from all
426
437
427− ProxyPreserveHost On
428− ProxyPass unix:/run/uwsgi/app/searx/socket|uwsgi://uwsgi-uds-searx/
429−
430− </Location>
438+ </Location>
431
439
432 </IfModule>
440 </IfModule>
433
441
@@ -473,3 +481,18 @@ one of the lines and `restart apache`_::
473The ``CustomLog`` directive disable logs for the whole (virtual) server, use it
481The ``CustomLog`` directive disable logs for the whole (virtual) server, use it
474when the URL of the service does not have a path component (``/searx``) / is
482when the URL of the service does not have a path component (``/searx``) / is
475located at root (``/``).
483located 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
25
25
26 This installs also the packages needed by :ref:`searx uwsgi`
26 This installs also the packages needed by :ref:`searx uwsgi`
27
27
28+.. _create searx user:
29+
28Create user
30Create user
29===========
31===========
30
32
utils/filtron.sh+3−5
@@ -441,14 +441,12 @@ This installs a reverse proxy (ProxyPass) into apache site (${APACHE_FILTRON_SIT
441
441
442 ! apache_is_installed && err_msg "Apache is not installed."
442 ! apache_is_installed && err_msg "Apache is not installed."
443
443
444− if ! ask_yn "Do you really want to continue?"; then
444+ if ! ask_yn "Do you really want to continue?" Yn; then
445 return
445 return
446+ else
447+ install_apache
446 fi
448 fi
447
449
448− a2enmod headers
449− a2enmod proxy
450− a2enmod proxy_http
451−
452 echo
450 echo
453 apache_install_site --variant=filtron "${APACHE_FILTRON_SITE}"
451 apache_install_site --variant=filtron "${APACHE_FILTRON_SITE}"
454
452
utils/lib.sh+97−22
@@ -627,21 +627,56 @@ EOF
627# Apache
627# Apache
628# ------
628# ------
629
629
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+}
631
658
632−if [[ -z "${APACHE_SITES_AVAILABE}" ]]; then
659+apache_distro_setup
633− APACHE_SITES_AVAILABE="/etc/apache2/sites-available"
634−fi
635
660
636−apache_is_installed() {
661+install_apache(){
662+ info_msg "installing apache ..."
663+ pkg_install "$APACHE_PACKAGES"
637 case $DIST_ID-$DIST_VERS in
664 case $DIST_ID-$DIST_VERS in
638− ubuntu-*|debian-*)
665+ arch-*|fedora-*)
639− (command -v apachectl \
666+ if ! grep "IncludeOptional sites-enabled" "/etc/httpd/conf/httpd.conf"; then
640− && command -v a2ensite \
667+ echo "IncludeOptional sites-enabled/*.conf" >> "/etc/httpd/conf/httpd.conf"
641− && command -v a2dissite ) &>/dev/null
668+ fi
669+ systemctl enable httpd
670+ systemctl start httpd
642 ;;
671 ;;
672+ esac
673+}
674+
675+apache_is_installed() {
676+ case $DIST_ID-$DIST_VERS in
677+ ubuntu-*|debian-*) (command -v apachectl) &>/dev/null;;
643− arch) (command -v httpd) ;;
678+ arch-*) (command -v httpd) &>/dev/null;;
644− fedora) (command -v httpd) ;;
679+ fedora-*) (command -v httpd) &>/dev/null;;
645 esac
680 esac
646}
681}
647
682
@@ -649,8 +684,16 @@ apache_reload() {
649
684
650 info_msg "reload apache .."
685 info_msg "reload apache .."
651 echo
686 echo
687+ case $DIST_ID-$DIST_VERS in
688+ ubuntu-*|debian-*)
652− sudo -H apachectl configtest
689+ sudo -H apachectl configtest
653− sudo -H service apache2 force-reload
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
654}
697}
655
698
656apache_install_site() {
699apache_install_site() {
@@ -670,9 +713,8 @@ apache_install_site() {
670 done
713 done
671
714
672 install_template "${template_opts[@]}" \
715 install_template "${template_opts[@]}" \
673− "${APACHE_SITES_AVAILABE}/${pos_args[1]}" \
716+ "${APACHE_SITES_AVAILABLE}/${pos_args[1]}" \
674 root root 644
717 root root 644
675−
676 apache_enable_site "${pos_args[1]}"
718 apache_enable_site "${pos_args[1]}"
677 info_msg "installed apache site: ${pos_args[1]}"
719 info_msg "installed apache site: ${pos_args[1]}"
678}
720}
@@ -683,15 +725,32 @@ apache_remove_site() {
683
725
684 info_msg "remove apache site: $1"
726 info_msg "remove apache site: $1"
685 apache_dissable_site "$1"
727 apache_dissable_site "$1"
686− rm -f "${APACHE_SITES_AVAILABE}/$1"
728+ rm -f "${APACHE_SITES_AVAILABLE}/$1"
687}
729}
688
730
689apache_enable_site() {
731apache_enable_site() {
690
732
691 # usage: apache_enable_site <mysite.conf>
733 # usage: apache_enable_site <mysite.conf>
692
734
735+ local CONF="$1"
736+
693− info_msg "enable apache site: $1"
737+ info_msg "enable apache site: ${CONF}"
738+
739+ case $DIST_ID-$DIST_VERS in
740+ ubuntu-*|debian-*)
694− sudo -H a2ensite -q "$1"
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
695 apache_reload
754 apache_reload
696}
755}
697
756
@@ -699,9 +758,25 @@ apache_dissable_site() {
699
758
700 # usage: apache_disable_site <mysite.conf>
759 # usage: apache_disable_site <mysite.conf>
701
760
761+ local CONF="$1"
762+
702− info_msg "disable apache site: $1"
763+ info_msg "disable apache site: ${CONF}"
764+
765+ case $DIST_ID-$DIST_VERS in
766+ ubuntu-*|debian-*)
703− sudo -H a2dissite -q "$1"
767+ sudo -H a2dissite -q "${CONF}"
704− apache_reload
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
705}
780}
706
781
707# uWSGI
782# uWSGI
@@ -741,7 +816,7 @@ uWSGI_distro_setup() {
741 uWSGI_GROUP="uwsgi"
816 uWSGI_GROUP="uwsgi"
742 ;;
817 ;;
743 *)
818 *)
744− info_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
819+ err_msg "$DIST_ID-$DIST_VERS: uWSGI not yet implemented"
745 ;;
820 ;;
746esac
821esac
747}
822}
utils/lxc.sh+3−6
@@ -98,7 +98,7 @@ start/stop
98show
98show
99 :info: show info of all (or <name>) containers from LXC suite
99 :info: show info of all (or <name>) containers from LXC suite
100 :config: show config of all (or <name>) containers from the LXC suite
100 :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
102 :images: show information of local images
102 :images: show information of local images
103cmd
103cmd
104 use single qoutes to evaluate in container's bash, e.g. 'echo $(hostname)'
104 use single qoutes to evaluate in container's bash, e.g. 'echo $(hostname)'
@@ -294,11 +294,9 @@ main() {
294
294
295build_all_containers() {
295build_all_containers() {
296 rst_title "Build all LXC containers of suite"
296 rst_title "Build all LXC containers of suite"
297+ echo
297 usage_containers
298 usage_containers
298 lxc_copy_images_localy
299 lxc_copy_images_localy
299− echo
300− rst_title "build containers" section
301− echo
302 lxc_init_all_containers
300 lxc_init_all_containers
303 lxc_config_all_containers
301 lxc_config_all_containers
304 lxc_boilerplate_all_containers
302 lxc_boilerplate_all_containers
@@ -368,7 +366,6 @@ remove_containers() {
368
366
369lxc_copy_images_localy() {
367lxc_copy_images_localy() {
370 rst_title "copy images" section
368 rst_title "copy images" section
371− echo
372 for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do
369 for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do
373 lxc_image_copy "${LXC_SUITE[i]}" "${LXC_SUITE[i+1]}"
370 lxc_image_copy "${LXC_SUITE[i]}" "${LXC_SUITE[i+1]}"
374 done
371 done
@@ -477,7 +474,7 @@ lxc_init_all_containers() {
477 local container_name
474 local container_name
478
475
479 for ((i=0; i<${#LXC_SUITE[@]}; i+=2)); do
476 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]}"
481 done
478 done
482}
479}
483
480
utils/makefile.include+3−1
@@ -1,9 +1,11 @@
1# -*- coding: utf-8; mode: makefile-gmake -*-
1# -*- coding: utf-8; mode: makefile-gmake -*-
2
2
3ifeq (,$(wildcard /.lxcenv.mk))
3ifeq (,$(wildcard /.lxcenv.mk))
4−PHONY += lxc-activate
4+PHONY += lxc-activate lxc-purge
5lxc-activate:
5lxc-activate:
6 @$(MAKE) -s -f /share/searx/utils/makefile.lxc lxc-activate
6 @$(MAKE) -s -f /share/searx/utils/makefile.lxc lxc-activate
7+lxc-purge:
8+ $(Q)rm -rf ./lxc
7else
9else
8 include /.lxcenv.mk
10 include /.lxcenv.mk
9endif
11endif
utils/morty.sh+3−6
@@ -402,15 +402,12 @@ This installs a reverse proxy (ProxyPass) into apache site (${APACHE_MORTY_SITE}
402
402
403 ! apache_is_installed && err_msg "Apache is not installed."
403 ! apache_is_installed && err_msg "Apache is not installed."
404
404
405− if ! ask_yn "Do you really want to continue?"; then
405+ if ! ask_yn "Do you really want to continue?" Yn; then
406 return
406 return
407+ else
408+ install_apache
407 fi
409 fi
408
410
409− a2enmod headers
410− a2enmod proxy
411− a2enmod proxy_http
412−
413− echo
414 apache_install_site "${APACHE_MORTY_SITE}"
411 apache_install_site "${APACHE_MORTY_SITE}"
415
412
416 info_msg "testing public url .."
413 info_msg "testing public url .."
utils/searx.sh+13−17
@@ -75,21 +75,23 @@ texlive-xetex-bin texlive-collection-fontsrecommended
75texlive-collection-latex dejavu-sans-fonts dejavu-serif-fonts
75texlive-collection-latex dejavu-sans-fonts dejavu-serif-fonts
76dejavu-sans-mono-fonts"
76dejavu-sans-mono-fonts"
77
77
78−case $DIST_ID in
78+case $DIST_ID-$DIST_VERS in
79− ubuntu|debian)
79+ ubuntu-16.04|ubuntu-18.04)
80 SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
80 SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
81 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
81 BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
82− APACHE_PACKAGES="libapache2-mod-uwsgi"
82+ APACHE_PACKAGES="$APACHE_PACKAGES libapache2-mod-proxy-uwsgi"
83 ;;
83 ;;
84+ ubuntu-*|debian-*)
85+ SEARX_PACKAGES="${SEARX_PACKAGES_debian}"
86+ BUILD_PACKAGES="${BUILD_PACKAGES_debian}"
87+ ;;
84− arch)
88+ arch-*)
85 SEARX_PACKAGES="${SEARX_PACKAGES_arch}"
89 SEARX_PACKAGES="${SEARX_PACKAGES_arch}"
86 BUILD_PACKAGES="${BUILD_PACKAGES_arch}"
90 BUILD_PACKAGES="${BUILD_PACKAGES_arch}"
87− APACHE_PACKAGES="uwsgi"
88 ;;
91 ;;
89− fedora)
92+ fedora-*)
90 SEARX_PACKAGES="${SEARX_PACKAGES_fedora}"
93 SEARX_PACKAGES="${SEARX_PACKAGES_fedora}"
91 BUILD_PACKAGES="${BUILD_PACKAGES_fedora}"
94 BUILD_PACKAGES="${BUILD_PACKAGES_fedora}"
92− APACHE_PACKAGES="uwsgi"
93 ;;
95 ;;
94esac
96esac
95
97
@@ -462,6 +464,7 @@ EOF
462 wait_key
464 wait_key
463 info_msg "install needed python packages"
465 info_msg "install needed python packages"
464 tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
466 tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
467+pip install wheel
465${SEARX_SRC}/manage.sh update_packages
468${SEARX_SRC}/manage.sh update_packages
466EOF
469EOF
467}
470}
@@ -735,21 +738,14 @@ This installs the searx uwsgi app as apache site. If your server is public to
735the internet, you should instead use a reverse proxy (filtron) to block
738the internet, you should instead use a reverse proxy (filtron) to block
736excessively bot queries."
739excessively bot queries."
737
740
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−
743 ! apache_is_installed && err_msg "Apache is not installed."
741 ! apache_is_installed && err_msg "Apache is not installed."
744
742
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
746 return
744 return
745+ else
746+ install_apache
747 fi
747 fi
748
748
749− pkg_install "$APACHE_PACKAGES"
750− a2enmod uwsgi
751−
752− echo
753 apache_install_site --variant=uwsgi "${APACHE_SEARX_SITE}"
749 apache_install_site --variant=uwsgi "${APACHE_SEARX_SITE}"
754
750
755 if ! service_is_available "${PUBLIC_URL}"; then
751 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 @@
1# -*- coding: utf-8; mode: apache -*-
1# -*- coding: utf-8; mode: apache -*-
2
2
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
4
10
5<Location ${PUBLIC_URL_PATH_MORTY} >
11<Location ${PUBLIC_URL_PATH_MORTY} >
6
12
@@ -15,12 +21,8 @@ ProxyPreserveHost On
15 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
21 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
16 Allow from all
22 Allow from all
17
23
24+ ProxyPreserveHost On
18 ProxyPass http://${MORTY_LISTEN}
25 ProxyPass http://${MORTY_LISTEN}
19 RequestHeader set X-Script-Name ${PUBLIC_URL_PATH_MORTY}
26 RequestHeader set X-Script-Name ${PUBLIC_URL_PATH_MORTY}
20
27
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−
26</Location>
28</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 @@
1# -*- coding: utf-8; mode: apache -*-
1# -*- coding: utf-8; mode: apache -*-
2
2
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
4
10
5# SecRuleRemoveById 981054
11# SecRuleRemoveById 981054
6# SecRuleRemoveById 981059
12# SecRuleRemoveById 981059
@@ -20,14 +26,8 @@ ProxyPreserveHost On
20 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
26 #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1
21 Allow from all
27 Allow from all
22
28
29+ ProxyPreserveHost On
23 ProxyPass http://${FILTRON_LISTEN}
30 ProxyPass http://${FILTRON_LISTEN}
24 RequestHeader set X-Script-Name ${FILTRON_URL_PATH}
31 RequestHeader set X-Script-Name ${FILTRON_URL_PATH}
25
32
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−
33</Location>
33</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>