Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| serveur_hebergement:installer_une_instance_searx [2022/10/02 17:46] – [Préparation] fate | serveur_hebergement:installer_une_instance_searx [2026/08/11 15:39] (Version actuelle) – fate | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== | + | ====== |
| - | ===== Présentation de Searx ===== | + | ===== Présentation de Searxng |
| + | |||
| + | [[https:// | ||
| ===== Préparation ===== | ===== Préparation ===== | ||
| - | Installez les dépendances : <code bash> | + | On va déployer Searxng via docker, donc il faut que docker-compose soit installé sur votre système |
| - | Créez un utilisateur searx : | + | ===== Installation de Searxng ===== |
| - | <code bash> | + | |
| - | Créez le répertoire | + | Créer un répertoire |
| - | <code bash>sudo mkdir "/usr/local/searx"< | + | <code bash> |
| + | # Read the documentation before using the `docker-compose.yml` file: | ||
| + | # https://docs.searxng.org/admin/installation-docker.html | ||
| - | Modifiez le propriétaire du répertoire home : | + | name: searxng |
| - | <code bash> | + | |
| - | ===== Installation de Searx ===== | + | services: |
| + | core: | ||
| + | container_name: | ||
| + | image: docker.io/ | ||
| + | restart: always | ||
| + | ports: | ||
| + | - ${SEARXNG_HOST: | ||
| + | env_file: ./.env | ||
| + | volumes: | ||
| + | - ./ | ||
| + | - ./ | ||
| - | Connectez-vous avec l' | + | valkey: |
| - | <code bash> | + | container_name: |
| + | image: docker.io/ | ||
| + | | ||
| + | restart: always | ||
| + | volumes: | ||
| + | - ./ | ||
| - | Récupérez les sources de Searx : | + | volumes: |
| - | <code bash>git clone "https:// | + | |
| + | valkey-data: | ||
| + | </ | ||
| - | Créez l' | + | Dans le même répertoire, |
| - | <code bash>python3 | + | <code bash> |
| + | # Read the documentation before using the `docker-compose.yml` file: | ||
| + | # https://docs.searxng.org/admin/installation-docker.html | ||
| + | # | ||
| + | # Additional ENVs: | ||
| + | # https:// | ||
| + | # https:// | ||
| - | Activez-le à chaque connexion : | + | # Use a specific version tag. E.g. "latest" |
| - | <code bash> | + | SEARXNG_VERSION=latest |
| - | Déconnectez vous avec la commande <code bash> | + | # Listen to a specific address. |
| - | Connectez-vous de nouveau avec l' | + | SEARXNG_HOST=[127.0.0.1] |
| - | <code bash> | + | |
| - | Mettre à jour les modules nécessaires : | + | # Listen to a specific port. |
| - | <code bash> | + | SEARXNG_PORT=8085 |
| - | pip install -U pip | + | |
| - | pip install -U setuptools | + | |
| - | pip install -U wheel | + | |
| - | pip install -U pyyaml | + | |
| </ | </ | ||
| - | Lancez | + | Lancez |
| - | <code bash> | + | <code bash>sudo docker compose up -d</ |
| - | cd "/ | + | |
| - | pip install -e . | + | |
| - | </ | + | |
| ===== Configuration ===== | ===== Configuration ===== | ||
| - | Dans un autre terminal, copiez | + | Ouvrez |
| <code bash> | <code bash> | ||
| - | sudo mkdir -p "/ | + | # Read the documentation before extending the defaults: |
| - | sudo cp "/usr/local/ | + | # https://docs.searxng.org/admin/settings/ |
| - | </code> | + | |
| - | Ouvrez le fichier / | + | use_default_settings: |
| - | Pour vérifiez que Searx se lance sans problème, activez le debug : | + | server: |
| - | <code bash> | + | |
| - | + | | |
| - | Connectez-vous de nouveau avec l' | + | |
| - | <code bash> | + | valkey: |
| + | | ||
| + | </ | ||
| - | Puis lancez searx : | + | Si vous voulez rendre mon instance privée mais accessible depuis n' |
| <code bash> | <code bash> | ||
| - | cd / | + | engines: |
| - | export SEARX_SETTINGS_PATH="/ | + | |
| - | python searx/ | + | |
| + | - name: bing | ||
| + | tokens: [' | ||
| + | - name: duckduckgo | ||
| + | | ||
| </ | </ | ||
| - | Désactivez | + | Pour pouvoir accéder à ces moteurs, vous devez coller votre token (ça peut être le même pour tous les moteurs) dans l' |
| - | <code bash>sudo sed -i -e " | + | |
| - | ===== uWSGI ===== | + | Créez le fichier core-config/ |
| + | <code bash> | ||
| + | [botdetection.ip_limit] | ||
| - | uWSGI va nous permettre de démarrer l' | + | # To get unlimited access in a local network, by default link-local addresses |
| + | # (networks) are not monitored by the ip_limit | ||
| + | filter_link_local = false | ||
| - | Créez le fichier de configuration pour uWSGI : | + | # activate link_token method in the ip_limit method |
| - | <code bash> | + | link_token = true |
| + | </ | ||
| - | Collez-y les lignes suivantes | + | Redémarrez le conteneur |
| <code bash> | <code bash> | ||
| - | [uwsgi] | + | sudo docker compose down |
| - | + | sudo docker compose up -d | |
| - | # uWSGI core | + | |
| - | # ---------- | + | |
| - | # | + | |
| - | # https:// | + | |
| - | + | ||
| - | # Who will run the code | + | |
| - | uid = searx | + | |
| - | gid = searx | + | |
| - | + | ||
| - | # 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 configuration (settings.yml) | + | |
| - | env = SEARX_SETTINGS_PATH=/ | + | |
| - | + | ||
| - | # disable logging for privacy | + | |
| - | disable-logging = true | + | |
| - | + | ||
| - | # The right granted on the created socket | + | |
| - | chmod-socket = 666 | + | |
| - | + | ||
| - | # Plugin to use and interpreter 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, | + | |
| - | + | ||
| - | # 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. | + | |
| - | # threads options) will automatically enable threading support. This *strange* | + | |
| - | # default behaviour is for performance reasons. | + | |
| - | enable-threads = true | + | |
| - | + | ||
| - | + | ||
| - | # plugin: python | + | |
| - | # -------------- | + | |
| - | # | + | |
| - | # https:// | + | |
| - | + | ||
| - | # load a WSGI module | + | |
| - | module = searx.webapp | + | |
| - | + | ||
| - | # set PYTHONHOME/ | + | |
| - | virtualenv = / | + | |
| - | + | ||
| - | # add directory (or glob) to pythonpath | + | |
| - | pythonpath = / | + | |
| - | + | ||
| - | + | ||
| - | # speak to upstream | + | |
| - | # ----------------- | + | |
| - | # | + | |
| - | # Activate the ' | + | |
| - | # configuration if you setup your HTTP server to use uWSGI protocol via sockets. | + | |
| - | + | ||
| - | # using IP: | + | |
| - | # | + | |
| - | # https:// | + | |
| - | # Native HTTP support: https:// | + | |
| - | + | ||
| - | http = 127.0.0.1: | + | |
| - | + | ||
| - | # using unix-sockets: | + | |
| - | # | + | |
| - | # On some distributions you need to create the app folder for the sockets:: | + | |
| - | # | + | |
| - | # mkdir -p / | + | |
| - | # chown -R searx: | + | |
| - | # | + | |
| - | # socket = / | + | |
| - | + | ||
| - | # Cache | + | |
| - | cache2 = name=searxcache, | + | |
| </ | </ | ||
| - | |||
| - | Activez le lancement au démarrage de Searx : | ||
| - | <code bash> | ||
| - | |||
| - | Démarrez Searx : | ||
| - | <code bash> | ||
| ===== Configuration d' | ===== Configuration d' | ||
| - | On va configurer Apache2 pour pour voir accéder à notre instance Searx via un sous domaine style searx.domaine.fr (je ne traiterai pas la gestion du nom de domaine) | + | On va configurer Apache2 pour pouvoir |
| Activez les modules Apache2 nécessaires : | Activez les modules Apache2 nécessaires : | ||
| - | <code bash> | + | <code bash> |
| Créez le fichier de config Apache2 : | Créez le fichier de config Apache2 : | ||
| <code bash> | <code bash> | ||
| - | Copiez-y les lignes suivantes (remplacez le noom de domaine par le votre ainsi que l' | + | Copiez-y les lignes suivantes (remplacez le nom de domaine par le vôtre |
| <code apache> | <code apache> | ||
| < | < | ||
| - | ServerName searx.nomdedomaine.fr | + | ServerName searx.domaine.fr |
| - | ServerAdmin fate@nomdedomaine.fr | + | |
| - | Redirect / https:// | + | Redirect / https:// |
| </ | </ | ||
| + | |||
| + | |||
| + | < | ||
| + | |||
| + | ServerName searx.domaine.fr | ||
| LogLevel warn | LogLevel warn | ||
| - | #CustomLog ${APACHE_LOG_DIR}/ | ||
| ErrorLog ${APACHE_LOG_DIR}/ | ErrorLog ${APACHE_LOG_DIR}/ | ||
| - | < | ||
| - | SSLEngine on | ||
| - | SSLProxyEngine On | ||
| - | ProxyRequests Off | ||
| - | ProxyPreserveHost On | ||
| - | SSLCertificateFile / | ||
| - | SSLCertificateKeyFile / | ||
| - | AddDefaultCharset utf-8 | ||
| - | HostnameLookups off | ||
| - | UseCanonicalName off | ||
| - | ProxyBadHeader Ignore | ||
| - | KeepAlive off | ||
| - | Header set Content-Security-Policy " | ||
| - | </ | ||
| - | # < | + | SSLEngine on |
| - | # | + | SSLProxyEngine On |
| - | # </ | + | ProxyRequests Off |
| + | ProxyPreserveHost On | ||
| + | SSLCertificateFile / | ||
| + | | ||
| + | AddDefaultCharset utf-8 | ||
| + | | ||
| + | UseCanonicalName off | ||
| + | ProxyBadHeader Ignore | ||
| + | KeepAlive off | ||
| - | <FilesMatch " | + | |
| - | | + | |
| - | </FilesMatch> | + | |
| + | Require all granted | ||
| + | </Location> | ||
| - | | + | |
| - | #ProxyPassReverse / http:// | + | # |
| + | #RequestHeader append X-Forwarded-For %{REMOTE_ADDR}s | ||
| - | | + | |
| - | | + | |
| - | | + | SSLOpenSSLConfCmd |
| + | SSLCipherSuite | ||
| + | SSLHonorCipherOrder | ||
| + | | ||
| - | | + | |
| - | | + | Protocols h2 http/1.1 |
| - | | + | |
| - | | + | # HTTP Strict Transport Security (mod_headers is required) (63072000 seconds) |
| + | Header always set Strict-Transport-Security | ||
| + | |||
| + | | ||
| + | Header set X-Content-Type-Options " | ||
| + | | ||
| + | Header unset X-Powered-By | ||
| + | | ||
| + | Header set Permissions-Policy | ||
| + | Header set Content-Security-Policy " | ||
| + | </ | ||
| </ | </ | ||
| - | # modern configuration, | ||
| - | SSLProtocol | ||
| - | SSLCipherSuite | ||
| - | SSLHonorCipherOrder | ||
| - | SSLCompression | ||
| - | SSLSessionTickets | ||
| - | # OCSP Stapling, only in httpd 2.3.3 and later | ||
| - | SSLUseStapling | ||
| - | SSLStaplingResponderTimeout 5 | ||
| - | SSLStaplingReturnResponderErrors off | ||
| - | SSLStaplingCache | ||
| </ | </ | ||
| Activez le fichier de configuration : | Activez le fichier de configuration : | ||
| <code bash> | <code bash> | ||
| + | |||
| + | Votre instance SearXNG est maintenant accessible à l' | ||
| + | |||
| + | |||
| + | |||