From 2b1252148d083eb47382733980ec069ef20dcfb6 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 11 Oct 2021 21:20:22 +0200 Subject: [brand] SearXNG - nginx & apache searxng.conf, uwsgi searxng.conf Signed-off-by: Markus Heiser --- docs/admin/installation-apache.rst | 2 +- docs/admin/installation-nginx.rst | 8 +- docs/admin/installation-uwsgi.rst | 14 ++-- docs/dev/lxcdev.rst | 2 +- utils/filtron.sh | 4 +- utils/searx.sh | 80 ++++++++++---------- .../etc/httpd/sites-available/searx.conf:filtron | 33 -------- .../etc/httpd/sites-available/searx.conf:uwsgi | 27 ------- .../etc/httpd/sites-available/searxng.conf:filtron | 33 ++++++++ .../etc/httpd/sites-available/searxng.conf:uwsgi | 27 +++++++ .../default.apps-available/searx.conf:filtron | 16 ---- .../default.apps-available/searxng.conf:filtron | 16 ++++ utils/templates/etc/uwsgi/apps-archlinux/searx.ini | 88 ---------------------- .../etc/uwsgi/apps-archlinux/searx.ini:socket | 85 --------------------- .../templates/etc/uwsgi/apps-archlinux/searxng.ini | 88 ++++++++++++++++++++++ .../etc/uwsgi/apps-archlinux/searxng.ini:socket | 85 +++++++++++++++++++++ utils/templates/etc/uwsgi/apps-available/searx.ini | 87 --------------------- .../etc/uwsgi/apps-available/searx.ini:socket | 84 --------------------- .../templates/etc/uwsgi/apps-available/searxng.ini | 87 +++++++++++++++++++++ .../etc/uwsgi/apps-available/searxng.ini:socket | 84 +++++++++++++++++++++ 20 files changed, 475 insertions(+), 475 deletions(-) delete mode 100644 utils/templates/etc/httpd/sites-available/searx.conf:filtron delete mode 100644 utils/templates/etc/httpd/sites-available/searx.conf:uwsgi create mode 100644 utils/templates/etc/httpd/sites-available/searxng.conf:filtron create mode 100644 utils/templates/etc/httpd/sites-available/searxng.conf:uwsgi delete mode 100644 utils/templates/etc/nginx/default.apps-available/searx.conf:filtron create mode 100644 utils/templates/etc/nginx/default.apps-available/searxng.conf:filtron delete mode 100644 utils/templates/etc/uwsgi/apps-archlinux/searx.ini delete mode 100644 utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket create mode 100644 utils/templates/etc/uwsgi/apps-archlinux/searxng.ini create mode 100644 utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket delete mode 100644 utils/templates/etc/uwsgi/apps-available/searx.ini delete mode 100644 utils/templates/etc/uwsgi/apps-available/searx.ini:socket create mode 100644 utils/templates/etc/uwsgi/apps-available/searxng.ini create mode 100644 utils/templates/etc/uwsgi/apps-available/searxng.ini:socket diff --git a/docs/admin/installation-apache.rst b/docs/admin/installation-apache.rst index 4ec085825..c15e3f5a0 100644 --- a/docs/admin/installation-apache.rst +++ b/docs/admin/installation-apache.rst @@ -482,7 +482,7 @@ Restart service .. code:: sh sudo -H systemctl restart httpd - sudo -H touch /etc/uwsgi.d/searx.ini + sudo -H touch /etc/uwsgi.d/searxng.ini disable logs diff --git a/docs/admin/installation-nginx.rst b/docs/admin/installation-nginx.rst index 4f58299ee..1d982bc8f 100644 --- a/docs/admin/installation-nginx.rst +++ b/docs/admin/installation-nginx.rst @@ -146,12 +146,12 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. group-tab:: Ubuntu / debian - Create configuration at ``/etc/nginx/sites-available/searx`` and place a + Create configuration at ``/etc/nginx/sites-available/searxng`` and place a symlink to sites-enabled: .. code:: sh - sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx + sudo -H ln -s /etc/nginx/sites-available/searxng /etc/nginx/sites-enabled/searxng .. group-tab:: Arch Linux @@ -160,7 +160,7 @@ Started wiki`_ is always a good resource *to keep in the pocket*. .. group-tab:: Fedora / RHEL - Create configuration at ``/etc/nginx/conf.d/searx`` and place a + Create configuration at ``/etc/nginx/conf.d/searxng`` and place a symlink to sites-enabled: .. _nginx searx via filtron plus morty: @@ -365,7 +365,7 @@ Restart service: .. code:: sh sudo -H systemctl restart nginx - sudo -H touch /etc/uwsgi.d/searx.ini + sudo -H touch /etc/uwsgi.d/searxng.ini Disable logs diff --git a/docs/admin/installation-uwsgi.rst b/docs/admin/installation-uwsgi.rst index e4b35dfc2..1fb24ca8f 100644 --- a/docs/admin/installation-uwsgi.rst +++ b/docs/admin/installation-uwsgi.rst @@ -35,10 +35,10 @@ recommend two methods `systemd.unit`_ template files as described here `One service per app in systemd`_. There is one `systemd unit template`_ and one `uwsgi ini file`_ per uWSGI-app - placed at dedicated locations. Take archlinux and a searx.ini as example:: + placed at dedicated locations. Take archlinux and a searxng.ini as example:: unit template --> /usr/lib/systemd/system/uwsgi@.service - uwsgi ini files --> /etc/uwsgi/searx.ini + uwsgi ini files --> /etc/uwsgi/searxng.ini The SearXNG app can be maintained as know from common systemd units:: @@ -54,12 +54,12 @@ The `uWSGI Emperor`_ mode which fits for maintaining a large range of uwsgi apps systemd unit. The Emperor service will scan specific directories for `uwsgi ini file`_\s (also know as *vassals*). If a *vassal* is added, removed or the timestamp is modified, a corresponding action takes place: a new uWSGI - instance is started, reload or stopped. Take Fedora and a searx.ini as + instance is started, reload or stopped. Take Fedora and a searxng.ini as example:: - to start a new SearXNG instance create --> /etc/uwsgi.d/searx.ini - to reload the instance edit timestamp --> touch /etc/uwsgi.d/searx.ini - to stop instance remove ini --> rm /etc/uwsgi.d/searx.ini + to start a new SearXNG instance create --> /etc/uwsgi.d/searxng.ini + to reload the instance edit timestamp --> touch /etc/uwsgi.d/searxng.ini + to stop instance remove ini --> rm /etc/uwsgi.d/searxng.ini Distributors ============ @@ -80,7 +80,7 @@ do similar for the uWSGI infrastructure (with less comfort), the folders are:: The `uwsgi ini file`_ is enabled by a symbolic link:: - ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/ + ln -s /etc/uwsgi/apps-available/searxng.ini /etc/uwsgi/apps-enabled/ From debian's documentation (``/usr/share/doc/uwsgi/README.Debian.gz``): You could control specific instance(s) by issuing:: diff --git a/docs/dev/lxcdev.rst b/docs/dev/lxcdev.rst index 49a2df6c8..e13667c0b 100644 --- a/docs/dev/lxcdev.rst +++ b/docs/dev/lxcdev.rst @@ -284,7 +284,7 @@ With the command above, we stopped the SearXNG uWSGI-App in the archlinux container. The uWSGI-App for the archlinux dsitros is configured in -:origin:`utils/templates/etc/uwsgi/apps-archlinux/searx.ini`, from where at +:origin:`utils/templates/etc/uwsgi/apps-archlinux/searxng.ini`, from where at least you should attend the settings of ``uid``, ``chdir``, ``env`` and ``http``:: diff --git a/utils/filtron.sh b/utils/filtron.sh index e4a4d32e8..e9fc79c87 100755 --- a/utils/filtron.sh +++ b/utils/filtron.sh @@ -46,8 +46,8 @@ GO_VERSION="go1.17.2" GO_PKG_URL="https://golang.org/dl/${GO_VERSION}.linux-amd64.tar.gz" GO_TAR=$(basename "$GO_PKG_URL") -APACHE_FILTRON_SITE="searx.conf" -NGINX_FILTRON_SITE="searx.conf" +APACHE_FILTRON_SITE="searxng.conf" +NGINX_FILTRON_SITE="searxng.conf" # shellcheck disable=SC2034 CONFIG_FILES=( diff --git a/utils/searx.sh b/utils/searx.sh index 00ee93010..3f50646e3 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -29,7 +29,7 @@ GIT_BRANCH="${GIT_BRANCH:-master}" SEARX_PYENV="${SERVICE_HOME}/searx-pyenv" SEARX_SRC="${SERVICE_HOME}/searx-src" SEARXNG_SETTINGS_PATH="/etc/searxng/settings.yml" -SEARX_UWSGI_APP="searx.ini" +SEARXNG_UWSGI_APP="searxng.ini" # shellcheck disable=SC2034 SEARX_UWSGI_SOCKET="/run/uwsgi/app/searx/socket" @@ -125,7 +125,7 @@ APACHE_SEARX_SITE="searx.conf" # shellcheck disable=SC2034 CONFIG_FILES=( - "${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}" + "${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP}" ) # shellcheck disable=SC2034 @@ -367,7 +367,7 @@ pip install -U pyyaml pip install -U -e . EOF install_settings - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } remove_all() { @@ -729,30 +729,30 @@ EOF } install_searx_uwsgi() { - rst_title "Install SearXNG's uWSGI app (searx.ini)" section + rst_title "Install SearXNG's uWSGI app (searxng.ini)" section echo install_uwsgi - uWSGI_install_app "$SEARX_UWSGI_APP" + uWSGI_install_app "$SEARXNG_UWSGI_APP" } remove_searx_uwsgi() { - rst_title "Remove SearXNG's uWSGI app (searx.ini)" section + rst_title "Remove SearXNG's uWSGI app (searxng.ini)" section echo - uWSGI_remove_app "$SEARX_UWSGI_APP" + uWSGI_remove_app "$SEARXNG_UWSGI_APP" } activate_service() { rst_title "Activate SearXNG (service)" section echo - uWSGI_enable_app "$SEARX_UWSGI_APP" - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_enable_app "$SEARXNG_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } deactivate_service() { rst_title "De-Activate SearXNG (service)" section echo - uWSGI_disable_app "$SEARX_UWSGI_APP" - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_disable_app "$SEARXNG_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } enable_image_proxy() { @@ -761,7 +761,7 @@ enable_image_proxy() { cd ${SEARX_SRC} sed -i -e "s/image_proxy: false/image_proxy: true/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } disable_image_proxy() { @@ -770,7 +770,7 @@ disable_image_proxy() { cd ${SEARX_SRC} sed -i -e "s/image_proxy: true/image_proxy: false/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } enable_debug() { @@ -780,7 +780,7 @@ enable_debug() { cd ${SEARX_SRC} sed -i -e "s/debug: false/debug: true/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } disable_debug() { @@ -789,7 +789,7 @@ disable_debug() { cd ${SEARX_SRC} sed -i -e "s/debug: true/debug: false/g" "$SEARXNG_SETTINGS_PATH" EOF - uWSGI_restart "$SEARX_UWSGI_APP" + uWSGI_restart "$SEARXNG_UWSGI_APP" } set_result_proxy() { @@ -869,14 +869,14 @@ EOF err_msg "~$SERVICE_USER: Missing SearXNG software!" fi - if uWSGI_app_enabled "$SEARX_UWSGI_APP"; then - info_msg "uWSGI app $SEARX_UWSGI_APP is enabled." + if uWSGI_app_enabled "$SEARXNG_UWSGI_APP"; then + info_msg "uWSGI app $SEARXNG_UWSGI_APP is enabled." else - err_msg "uWSGI app $SEARX_UWSGI_APP not enabled!" + err_msg "uWSGI app $SEARXNG_UWSGI_APP not enabled!" fi - uWSGI_app_available "$SEARX_UWSGI_APP" \ - || err_msg "uWSGI app $SEARX_UWSGI_APP not available!" + uWSGI_app_available "$SEARXNG_UWSGI_APP" \ + || err_msg "uWSGI app $SEARXNG_UWSGI_APP not available!" if in_container; then lxc_suite_info @@ -955,9 +955,9 @@ excessively bot queries." apache_install_site --variant=uwsgi "${APACHE_SEARX_SITE}" - rst_title "Install SearXNG's uWSGI app (searx.ini)" section + rst_title "Install SearXNG's uWSGI app (searxng.ini)" section echo - uWSGI_install_app --variant=socket "$SEARX_UWSGI_APP" + uWSGI_install_app --variant=socket "$SEARXNG_UWSGI_APP" if ! service_is_available "${PUBLIC_URL}"; then err_msg "Public service at ${PUBLIC_URL} is not available!" @@ -979,9 +979,9 @@ This removes apache site ${APACHE_SEARX_SITE}." apache_remove_site "${APACHE_SEARX_SITE}" - rst_title "Remove SearXNG's uWSGI app (searx.ini)" section + rst_title "Remove SearXNG's uWSGI app (searxng.ini)" section echo - uWSGI_remove_app "$SEARX_UWSGI_APP" + uWSGI_remove_app "$SEARXNG_UWSGI_APP" } rst-doc() { @@ -1025,12 +1025,12 @@ rst-doc() { # For uWSGI debian uses the LSB init process, this might be changed # one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067 - create ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP} - enable: sudo -H ln -s ${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP} ${uWSGI_APPS_ENABLED}/ - start: sudo -H service uwsgi start ${SEARX_UWSGI_APP%.*} - restart: sudo -H service uwsgi restart ${SEARX_UWSGI_APP%.*} - stop: sudo -H service uwsgi stop ${SEARX_UWSGI_APP%.*} - disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} + create ${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP} + enable: sudo -H ln -s ${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP} ${uWSGI_APPS_ENABLED}/ + start: sudo -H service uwsgi start ${SEARXNG_UWSGI_APP%.*} + restart: sudo -H service uwsgi restart ${SEARXNG_UWSGI_APP%.*} + stop: sudo -H service uwsgi stop ${SEARXNG_UWSGI_APP%.*} + disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} EOF ;; @@ -1043,12 +1043,12 @@ EOF # - http://0pointer.de/blog/projects/instances.html # - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd - create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} - enable: sudo -H systemctl enable uwsgi@${SEARX_UWSGI_APP%.*} - start: sudo -H systemctl start uwsgi@${SEARX_UWSGI_APP%.*} - restart: sudo -H systemctl restart uwsgi@${SEARX_UWSGI_APP%.*} - stop: sudo -H systemctl stop uwsgi@${SEARX_UWSGI_APP%.*} - disable: sudo -H systemctl disable uwsgi@${SEARX_UWSGI_APP%.*} + create: ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} + enable: sudo -H systemctl enable uwsgi@${SEARXNG_UWSGI_APP%.*} + start: sudo -H systemctl start uwsgi@${SEARXNG_UWSGI_APP%.*} + restart: sudo -H systemctl restart uwsgi@${SEARXNG_UWSGI_APP%.*} + stop: sudo -H systemctl stop uwsgi@${SEARXNG_UWSGI_APP%.*} + disable: sudo -H systemctl disable uwsgi@${SEARXNG_UWSGI_APP%.*} EOF ;; @@ -1060,9 +1060,9 @@ EOF # The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see # - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html - create: ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} - restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} - disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARX_UWSGI_APP} + create: ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} + restart: sudo -H touch ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} + disable: sudo -H rm ${uWSGI_APPS_ENABLED}/${SEARXNG_UWSGI_APP} EOF ;; @@ -1072,7 +1072,7 @@ EOF echo -e "\n.. START searx uwsgi-appini $DIST_NAME" echo ".. code:: bash" echo - eval "echo \"$(< "${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARX_UWSGI_APP}")\"" | prefix_stdout " " + eval "echo \"$(< "${TEMPLATES}/${uWSGI_APPS_AVAILABLE}/${SEARXNG_UWSGI_APP}")\"" | prefix_stdout " " echo -e "\n.. END searx uwsgi-appini $DIST_NAME" ) diff --git a/utils/templates/etc/httpd/sites-available/searx.conf:filtron b/utils/templates/etc/httpd/sites-available/searx.conf:filtron deleted file mode 100644 index 379d47e24..000000000 --- a/utils/templates/etc/httpd/sites-available/searx.conf:filtron +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8; mode: apache -*- - -LoadModule headers_module ${APACHE_MODULES}/mod_headers.so -LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so -LoadModule proxy_http_module ${APACHE_MODULES}/mod_proxy_http.so -#LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so - -# SetEnvIf Request_URI "${FILTRON_URL_PATH}" dontlog -# CustomLog /dev/null combined env=dontlog - -# SecRuleRemoveById 981054 -# SecRuleRemoveById 981059 -# SecRuleRemoveById 981060 -# SecRuleRemoveById 950907 - - - - - SecRuleEngine Off - - - Require all granted - - Order deny,allow - Deny from all - #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1 - Allow from all - - ProxyPreserveHost On - ProxyPass http://${FILTRON_LISTEN} - RequestHeader set X-Script-Name ${FILTRON_URL_PATH} - - diff --git a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi b/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi deleted file mode 100644 index aabc125ae..000000000 --- a/utils/templates/etc/httpd/sites-available/searx.conf:uwsgi +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8; mode: apache -*- - -LoadModule headers_module ${APACHE_MODULES}/mod_headers.so -LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so -LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so -# LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so - -# SetEnvIf Request_URI "${SEARXNG_URL_PATH}" dontlog -# CustomLog /dev/null combined env=dontlog - - - - - SecRuleEngine Off - - - Require all granted - - Order deny,allow - Deny from all - # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1 - Allow from all - - ProxyPreserveHost On - ProxyPass unix:${SEARX_UWSGI_SOCKET}|uwsgi://uwsgi-uds-searx/ - - diff --git a/utils/templates/etc/httpd/sites-available/searxng.conf:filtron b/utils/templates/etc/httpd/sites-available/searxng.conf:filtron new file mode 100644 index 000000000..379d47e24 --- /dev/null +++ b/utils/templates/etc/httpd/sites-available/searxng.conf:filtron @@ -0,0 +1,33 @@ +# -*- coding: utf-8; mode: apache -*- + +LoadModule headers_module ${APACHE_MODULES}/mod_headers.so +LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so +LoadModule proxy_http_module ${APACHE_MODULES}/mod_proxy_http.so +#LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so + +# SetEnvIf Request_URI "${FILTRON_URL_PATH}" dontlog +# CustomLog /dev/null combined env=dontlog + +# SecRuleRemoveById 981054 +# SecRuleRemoveById 981059 +# SecRuleRemoveById 981060 +# SecRuleRemoveById 950907 + + + + + SecRuleEngine Off + + + Require all granted + + Order deny,allow + Deny from all + #Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1 + Allow from all + + ProxyPreserveHost On + ProxyPass http://${FILTRON_LISTEN} + RequestHeader set X-Script-Name ${FILTRON_URL_PATH} + + diff --git a/utils/templates/etc/httpd/sites-available/searxng.conf:uwsgi b/utils/templates/etc/httpd/sites-available/searxng.conf:uwsgi new file mode 100644 index 000000000..aabc125ae --- /dev/null +++ b/utils/templates/etc/httpd/sites-available/searxng.conf:uwsgi @@ -0,0 +1,27 @@ +# -*- coding: utf-8; mode: apache -*- + +LoadModule headers_module ${APACHE_MODULES}/mod_headers.so +LoadModule proxy_module ${APACHE_MODULES}/mod_proxy.so +LoadModule proxy_uwsgi_module ${APACHE_MODULES}/mod_proxy_uwsgi.so +# LoadModule setenvif_module ${APACHE_MODULES}/mod_setenvif.so + +# SetEnvIf Request_URI "${SEARXNG_URL_PATH}" dontlog +# CustomLog /dev/null combined env=dontlog + + + + + SecRuleEngine Off + + + Require all granted + + Order deny,allow + Deny from all + # Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1 + Allow from all + + ProxyPreserveHost On + ProxyPass unix:${SEARX_UWSGI_SOCKET}|uwsgi://uwsgi-uds-searx/ + + diff --git a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron b/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron deleted file mode 100644 index e25461c47..000000000 --- a/utils/templates/etc/nginx/default.apps-available/searx.conf:filtron +++ /dev/null @@ -1,16 +0,0 @@ -# https://example.org/searx - -location ${SEARXNG_URL_PATH} { - proxy_pass http://127.0.0.1:4004/; - - proxy_set_header Host \$host; - proxy_set_header Connection \$http_connection; - 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_set_header X-Script-Name ${SEARXNG_URL_PATH}; -} - -location ${SEARXNG_URL_PATH}/static/ { - alias ${SEARX_SRC}/searx/static/; -} diff --git a/utils/templates/etc/nginx/default.apps-available/searxng.conf:filtron b/utils/templates/etc/nginx/default.apps-available/searxng.conf:filtron new file mode 100644 index 000000000..e25461c47 --- /dev/null +++ b/utils/templates/etc/nginx/default.apps-available/searxng.conf:filtron @@ -0,0 +1,16 @@ +# https://example.org/searx + +location ${SEARXNG_URL_PATH} { + proxy_pass http://127.0.0.1:4004/; + + proxy_set_header Host \$host; + proxy_set_header Connection \$http_connection; + 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_set_header X-Script-Name ${SEARXNG_URL_PATH}; +} + +location ${SEARXNG_URL_PATH}/static/ { + alias ${SEARX_SRC}/searx/static/; +} diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini deleted file mode 100644 index dcb7d1a7d..000000000 --- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini +++ /dev/null @@ -1,88 +0,0 @@ -[uwsgi] - -# uWSGI core -# ---------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core - -# Who will run the code -uid = ${SERVICE_USER} -gid = ${SERVICE_GROUP} - -# set (python) default encoding UTF-8 -env = LANG=C.UTF-8 -env = LANGUAGE=C.UTF-8 -env = LC_ALL=C.UTF-8 - -# chdir to specified directory before apps loading -chdir = ${SEARX_SRC}/searx - -# searx configuration (settings.yml) -env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} - -# disable logging for privacy -logger = systemd -disable-logging = true - -# The right granted on the created socket -chmod-socket = 666 - -# Plugin to use and interpretor config -single-interpreter = true - -# enable master process -master = true - -# load apps in each worker instead of the master -lazy-apps = true - -# load uWSGI plugins -plugin = python - -# By default the Python plugin does not initialize the GIL. This means your -# app-generated threads will not run. If you need threads, remember to enable -# them with enable-threads. Running uWSGI in multithreading mode (with the -# threads options) will automatically enable threading support. This *strange* -# default behaviour is for performance reasons. -enable-threads = true - - -# plugin: python -# -------------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python - -# load a WSGI module -module = searx.webapp - -# set PYTHONHOME/virtualenv -virtualenv = ${SEARX_PYENV} - -# add directory (or glob) to pythonpath -pythonpath = ${SEARX_SRC} - - -# speak to upstream -# ----------------- -# -# Activate the 'http' configuration for filtron or activate the 'socket' -# configuration if you setup your HTTP server to use uWSGI protocol via sockets. - -# using IP: -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http -# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html - -http = ${SEARX_INTERNAL_HTTP} - -# using unix-sockets: -# -# On some distributions you need to create the app folder for the sockets:: -# -# mkdir -p /run/uwsgi/app/searx -# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx -# -# socket = /run/uwsgi/app/searx/socket - -# Cache -cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1 diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket b/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket deleted file mode 100644 index 580600072..000000000 --- a/utils/templates/etc/uwsgi/apps-archlinux/searx.ini:socket +++ /dev/null @@ -1,85 +0,0 @@ -[uwsgi] - -# uWSGI core -# ---------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core - -# Who will run the code -uid = ${SERVICE_USER} -gid = ${SERVICE_GROUP} - -# set (python) default encoding UTF-8 -env = LANG=C.UTF-8 -env = LANGUAGE=C.UTF-8 -env = LC_ALL=C.UTF-8 - -# chdir to specified directory before apps loading -chdir = ${SEARX_SRC}/searx - -# searx configuration (settings.yml) -env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} - -# disable logging for privacy -logger = systemd -disable-logging = true - -# The right granted on the created socket -chmod-socket = 666 - -# Plugin to use and interpretor config -single-interpreter = true - -# enable master process -master = true - -# load apps in each worker instead of the master -lazy-apps = true - -# load uWSGI plugins -plugin = python - -# By default the Python plugin does not initialize the GIL. This means your -# app-generated threads will not run. If you need threads, remember to enable -# them with enable-threads. Running uWSGI in multithreading mode (with the -# threads options) will automatically enable threading support. This *strange* -# default behaviour is for performance reasons. -enable-threads = true - - -# plugin: python -# -------------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python - -# load a WSGI module -module = searx.webapp - -# set PYTHONHOME/virtualenv -virtualenv = ${SEARX_PYENV} - -# add directory (or glob) to pythonpath -pythonpath = ${SEARX_SRC} - - -# speak to upstream -# ----------------- -# -# Activate the 'http' configuration for filtron or activate the 'socket' -# configuration if you setup your HTTP server to use uWSGI protocol via sockets. - -# using IP: -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http -# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html - -# http = ${SEARX_INTERNAL_HTTP} - -# using unix-sockets: -# -# On some distributions you need to create the app folder for the sockets:: -# -# mkdir -p /run/uwsgi/app/searx -# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx -# -socket = /run/uwsgi/app/searx/socket \ No newline at end of file diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini new file mode 100644 index 000000000..dcb7d1a7d --- /dev/null +++ b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini @@ -0,0 +1,88 @@ +[uwsgi] + +# uWSGI core +# ---------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core + +# Who will run the code +uid = ${SERVICE_USER} +gid = ${SERVICE_GROUP} + +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + +# chdir to specified directory before apps loading +chdir = ${SEARX_SRC}/searx + +# searx configuration (settings.yml) +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} + +# disable logging for privacy +logger = systemd +disable-logging = true + +# The right granted on the created socket +chmod-socket = 666 + +# Plugin to use and interpretor config +single-interpreter = true + +# enable master process +master = true + +# load apps in each worker instead of the master +lazy-apps = true + +# load uWSGI plugins +plugin = python + +# By default the Python plugin does not initialize the GIL. This means your +# app-generated threads will not run. If you need threads, remember to enable +# them with enable-threads. Running uWSGI in multithreading mode (with the +# threads options) will automatically enable threading support. This *strange* +# default behaviour is for performance reasons. +enable-threads = true + + +# plugin: python +# -------------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python + +# load a WSGI module +module = searx.webapp + +# set PYTHONHOME/virtualenv +virtualenv = ${SEARX_PYENV} + +# add directory (or glob) to pythonpath +pythonpath = ${SEARX_SRC} + + +# speak to upstream +# ----------------- +# +# Activate the 'http' configuration for filtron or activate the 'socket' +# configuration if you setup your HTTP server to use uWSGI protocol via sockets. + +# using IP: +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http +# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html + +http = ${SEARX_INTERNAL_HTTP} + +# using unix-sockets: +# +# On some distributions you need to create the app folder for the sockets:: +# +# mkdir -p /run/uwsgi/app/searx +# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx +# +# socket = /run/uwsgi/app/searx/socket + +# Cache +cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1 diff --git a/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket new file mode 100644 index 000000000..580600072 --- /dev/null +++ b/utils/templates/etc/uwsgi/apps-archlinux/searxng.ini:socket @@ -0,0 +1,85 @@ +[uwsgi] + +# uWSGI core +# ---------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core + +# Who will run the code +uid = ${SERVICE_USER} +gid = ${SERVICE_GROUP} + +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + +# chdir to specified directory before apps loading +chdir = ${SEARX_SRC}/searx + +# searx configuration (settings.yml) +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} + +# disable logging for privacy +logger = systemd +disable-logging = true + +# The right granted on the created socket +chmod-socket = 666 + +# Plugin to use and interpretor config +single-interpreter = true + +# enable master process +master = true + +# load apps in each worker instead of the master +lazy-apps = true + +# load uWSGI plugins +plugin = python + +# By default the Python plugin does not initialize the GIL. This means your +# app-generated threads will not run. If you need threads, remember to enable +# them with enable-threads. Running uWSGI in multithreading mode (with the +# threads options) will automatically enable threading support. This *strange* +# default behaviour is for performance reasons. +enable-threads = true + + +# plugin: python +# -------------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python + +# load a WSGI module +module = searx.webapp + +# set PYTHONHOME/virtualenv +virtualenv = ${SEARX_PYENV} + +# add directory (or glob) to pythonpath +pythonpath = ${SEARX_SRC} + + +# speak to upstream +# ----------------- +# +# Activate the 'http' configuration for filtron or activate the 'socket' +# configuration if you setup your HTTP server to use uWSGI protocol via sockets. + +# using IP: +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http +# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html + +# http = ${SEARX_INTERNAL_HTTP} + +# using unix-sockets: +# +# On some distributions you need to create the app folder for the sockets:: +# +# mkdir -p /run/uwsgi/app/searx +# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx +# +socket = /run/uwsgi/app/searx/socket \ No newline at end of file diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini b/utils/templates/etc/uwsgi/apps-available/searx.ini deleted file mode 100644 index 440c2e97d..000000000 --- a/utils/templates/etc/uwsgi/apps-available/searx.ini +++ /dev/null @@ -1,87 +0,0 @@ -[uwsgi] - -# uWSGI core -# ---------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core - -# Who will run the code -uid = ${SERVICE_USER} -gid = ${SERVICE_GROUP} - -# set (python) default encoding UTF-8 -env = LANG=C.UTF-8 -env = LANGUAGE=C.UTF-8 -env = LC_ALL=C.UTF-8 - -# chdir to specified directory before apps loading -chdir = ${SEARX_SRC}/searx - -# searx configuration (settings.yml) -env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} - -# disable logging for privacy -disable-logging = true - -# The right granted on the created socket -chmod-socket = 666 - -# Plugin to use and interpretor config -single-interpreter = true - -# enable master process -master = true - -# load apps in each worker instead of the master -lazy-apps = true - -# load uWSGI plugins -plugin = python3,http - -# By default the Python plugin does not initialize the GIL. This means your -# app-generated threads will not run. If you need threads, remember to enable -# them with enable-threads. Running uWSGI in multithreading mode (with the -# threads options) will automatically enable threading support. This *strange* -# default behaviour is for performance reasons. -enable-threads = true - - -# plugin: python -# -------------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python - -# load a WSGI module -module = searx.webapp - -# set PYTHONHOME/virtualenv -virtualenv = ${SEARX_PYENV} - -# add directory (or glob) to pythonpath -pythonpath = ${SEARX_SRC} - - -# speak to upstream -# ----------------- -# -# Activate the 'http' configuration for filtron or activate the 'socket' -# configuration if you setup your HTTP server to use uWSGI protocol via sockets. - -# using IP: -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http -# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html - -http = ${SEARX_INTERNAL_HTTP} - -# using unix-sockets: -# -# On some distributions you need to create the app folder for the sockets:: -# -# mkdir -p /run/uwsgi/app/searx -# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx -# -# socket = /run/uwsgi/app/searx/socket - -# Cache -cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1 diff --git a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket b/utils/templates/etc/uwsgi/apps-available/searx.ini:socket deleted file mode 100644 index 08c98cf61..000000000 --- a/utils/templates/etc/uwsgi/apps-available/searx.ini:socket +++ /dev/null @@ -1,84 +0,0 @@ -[uwsgi] - -# uWSGI core -# ---------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core - -# Who will run the code -uid = ${SERVICE_USER} -gid = ${SERVICE_GROUP} - -# set (python) default encoding UTF-8 -env = LANG=C.UTF-8 -env = LANGUAGE=C.UTF-8 -env = LC_ALL=C.UTF-8 - -# chdir to specified directory before apps loading -chdir = ${SEARX_SRC}/searx - -# searx configuration (settings.yml) -env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} - -# disable logging for privacy -disable-logging = true - -# The right granted on the created socket -chmod-socket = 666 - -# Plugin to use and interpretor config -single-interpreter = true - -# enable master process -master = true - -# load apps in each worker instead of the master -lazy-apps = true - -# load uWSGI plugins -plugin = python3,http - -# By default the Python plugin does not initialize the GIL. This means your -# app-generated threads will not run. If you need threads, remember to enable -# them with enable-threads. Running uWSGI in multithreading mode (with the -# threads options) will automatically enable threading support. This *strange* -# default behaviour is for performance reasons. -enable-threads = true - - -# plugin: python -# -------------- -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python - -# load a WSGI module -module = searx.webapp - -# set PYTHONHOME/virtualenv -virtualenv = ${SEARX_PYENV} - -# add directory (or glob) to pythonpath -pythonpath = ${SEARX_SRC} - - -# speak to upstream -# ----------------- -# -# Activate the 'http' configuration for filtron or activate the 'socket' -# configuration if you setup your HTTP server to use uWSGI protocol via sockets. - -# using IP: -# -# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http -# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html - -# http = ${SEARX_INTERNAL_HTTP} - -# using unix-sockets: -# -# On some distributions you need to create the app folder for the sockets:: -# -# mkdir -p /run/uwsgi/app/searx -# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx -# -socket = /run/uwsgi/app/searx/socket \ No newline at end of file diff --git a/utils/templates/etc/uwsgi/apps-available/searxng.ini b/utils/templates/etc/uwsgi/apps-available/searxng.ini new file mode 100644 index 000000000..440c2e97d --- /dev/null +++ b/utils/templates/etc/uwsgi/apps-available/searxng.ini @@ -0,0 +1,87 @@ +[uwsgi] + +# uWSGI core +# ---------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core + +# Who will run the code +uid = ${SERVICE_USER} +gid = ${SERVICE_GROUP} + +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + +# chdir to specified directory before apps loading +chdir = ${SEARX_SRC}/searx + +# searx configuration (settings.yml) +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} + +# disable logging for privacy +disable-logging = true + +# The right granted on the created socket +chmod-socket = 666 + +# Plugin to use and interpretor config +single-interpreter = true + +# enable master process +master = true + +# load apps in each worker instead of the master +lazy-apps = true + +# load uWSGI plugins +plugin = python3,http + +# By default the Python plugin does not initialize the GIL. This means your +# app-generated threads will not run. If you need threads, remember to enable +# them with enable-threads. Running uWSGI in multithreading mode (with the +# threads options) will automatically enable threading support. This *strange* +# default behaviour is for performance reasons. +enable-threads = true + + +# plugin: python +# -------------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python + +# load a WSGI module +module = searx.webapp + +# set PYTHONHOME/virtualenv +virtualenv = ${SEARX_PYENV} + +# add directory (or glob) to pythonpath +pythonpath = ${SEARX_SRC} + + +# speak to upstream +# ----------------- +# +# Activate the 'http' configuration for filtron or activate the 'socket' +# configuration if you setup your HTTP server to use uWSGI protocol via sockets. + +# using IP: +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http +# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html + +http = ${SEARX_INTERNAL_HTTP} + +# using unix-sockets: +# +# On some distributions you need to create the app folder for the sockets:: +# +# mkdir -p /run/uwsgi/app/searx +# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx +# +# socket = /run/uwsgi/app/searx/socket + +# Cache +cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1 diff --git a/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket b/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket new file mode 100644 index 000000000..08c98cf61 --- /dev/null +++ b/utils/templates/etc/uwsgi/apps-available/searxng.ini:socket @@ -0,0 +1,84 @@ +[uwsgi] + +# uWSGI core +# ---------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core + +# Who will run the code +uid = ${SERVICE_USER} +gid = ${SERVICE_GROUP} + +# set (python) default encoding UTF-8 +env = LANG=C.UTF-8 +env = LANGUAGE=C.UTF-8 +env = LC_ALL=C.UTF-8 + +# chdir to specified directory before apps loading +chdir = ${SEARX_SRC}/searx + +# searx configuration (settings.yml) +env = SEARXNG_SETTINGS_PATH=${SEARXNG_SETTINGS_PATH} + +# disable logging for privacy +disable-logging = true + +# The right granted on the created socket +chmod-socket = 666 + +# Plugin to use and interpretor config +single-interpreter = true + +# enable master process +master = true + +# load apps in each worker instead of the master +lazy-apps = true + +# load uWSGI plugins +plugin = python3,http + +# By default the Python plugin does not initialize the GIL. This means your +# app-generated threads will not run. If you need threads, remember to enable +# them with enable-threads. Running uWSGI in multithreading mode (with the +# threads options) will automatically enable threading support. This *strange* +# default behaviour is for performance reasons. +enable-threads = true + + +# plugin: python +# -------------- +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python + +# load a WSGI module +module = searx.webapp + +# set PYTHONHOME/virtualenv +virtualenv = ${SEARX_PYENV} + +# add directory (or glob) to pythonpath +pythonpath = ${SEARX_SRC} + + +# speak to upstream +# ----------------- +# +# Activate the 'http' configuration for filtron or activate the 'socket' +# configuration if you setup your HTTP server to use uWSGI protocol via sockets. + +# using IP: +# +# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http +# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html + +# http = ${SEARX_INTERNAL_HTTP} + +# using unix-sockets: +# +# On some distributions you need to create the app folder for the sockets:: +# +# mkdir -p /run/uwsgi/app/searx +# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx +# +socket = /run/uwsgi/app/searx/socket \ No newline at end of file -- cgit v1.2.3