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 [2025/01/25 17:19] – [Redis] fate | serveur_hebergement:installer_une_instance_searx [2026/08/11 15:39] (Version actuelle) – fate | ||
|---|---|---|---|
| Ligne 7: | Ligne 7: | ||
| ===== 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 searxng : | + | ===== Installation de Searxng ===== |
| - | <code bash> | + | |
| - | Créez le répertoire | + | Créer un répertoire |
| - | <code bash>sudo mkdir -p /usr/local/searxng/run/</ | + | <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 Searxng ===== | + | 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 Searxng | + | 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/ | ||
| + | # | ||
| + | # Additional ENVs: | ||
| + | # https://docs.searxng.org/admin/ | ||
| + | # 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, créez | + | Ouvrez |
| <code bash> | <code bash> | ||
| - | sudo mkdir -p "/etc/searxng" | + | # Read the documentation before extending the defaults: |
| - | sudo nano /etc/searxng/settings.yml | + | # https://docs.searxng.org/admin/settings/ |
| - | </code> | + | |
| - | + | ||
| - | Copiez-y les lignes suivantes (modifiez la clé secrète et l' | + | |
| - | < | + | |
| - | # SearXNG settings | + | |
| use_default_settings: | use_default_settings: | ||
| - | |||
| - | general: | ||
| - | debug: false | ||
| - | instance_name: | ||
| - | contact_url: | ||
| - | |||
| - | search: | ||
| - | safe_search: | ||
| - | autocomplete: | ||
| - | formats: | ||
| - | - html | ||
| server: | server: | ||
| - | secret_key: "générez la clé secrète avec la commande : openssl rand -hex 16" | + | secret_key: "dQmtqyS1rEuuFLQgW0xHgFSQ2CP5cZS" |
| + | image_proxy: | ||
| limiter: true | limiter: true | ||
| - | image_proxy: | + | valkey: |
| - | + | url: valkey://valkey:6379/0 | |
| - | redis: | + | </code> |
| - | url: unix:///usr/ | + | |
| - | + | ||
| - | ui: | + | |
| - | # Custom static path - leave it blank if you didn't change | + | |
| - | static_path: | + | |
| - | static_use_hash: | + | |
| - | # Custom templates path - leave it blank if you didn't change | + | |
| - | templates_path: | + | |
| - | # query_in_title: | + | |
| - | # it decreases the privacy, since the browser can records the page titles. | + | |
| - | query_in_title: | + | |
| - | # infinite_scroll: | + | |
| - | infinite_scroll: | + | |
| - | # ui theme | + | |
| - | default_theme: | + | |
| - | # center the results ? | + | |
| - | center_alignment: | + | |
| - | # URL prefix of the internet archive, don't forgett trailing slash (if needed). | + | |
| - | # cache_url: " | + | |
| - | # Default interface locale - leave blank to detect from browser information or | + | |
| - | # use codes from the ' | + | |
| - | default_locale: | + | |
| - | # Open result links in a new tab by default | + | |
| - | results_on_new_tab: | + | |
| - | theme_args: | + | |
| - | # style of simple theme: auto, light, dark | + | |
| - | simple_style: | + | |
| - | + | ||
| - | # preferences: | + | |
| - | # | + | |
| - | # - autocomplete | + | |
| - | # - method | + | |
| - | + | ||
| - | enabled_plugins: | + | |
| - | - 'Hash plugin' | + | |
| - | - ' | + | |
| - | - 'Self Informations' | + | |
| - | - ' | + | |
| - | - 'Ahmia blacklist' | + | |
| - | # - ' | + | |
| - | # - ' | + | |
| - | # - 'Open Access DOI rewrite' | + | |
| - | # - ' | + | |
| - | + | ||
| - | # plugins: | + | |
| - | # - only_show_green_results | + | |
| + | Si vous voulez rendre mon instance privée mais accessible depuis n' | ||
| + | <code bash> | ||
| engines: | engines: | ||
| - | - name: google | + | - name: google |
| - | | + | |
| - | | + | - name: bing |
| - | | + | |
| - | use_mobile_ui: true | + | |
| - | | + | |
| - | # | + | |
| </ | </ | ||
| - | Voici les principales options par défaut activées | + | Pour pouvoir accéder à ces moteurs, vous devez coller votre token (ça peut être le même pour tous les moteurs) |
| - | * safe_search: | + | |
| - | * autocomplete: | + | |
| - | * formats: - html -> seule l' | + | |
| - | * limiter: true -> active le filtre anti-bot | + | |
| - | * results_on_new_tab: | + | |
| - | * use_mobile_ui: | + | |
| - | ===== Redis ===== | + | Créez le fichier core-config/ |
| + | <code bash> | ||
| + | [botdetection.ip_limit] | ||
| - | Redis va stocker la base de donnée du plugin " | + | # 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 | ||
| - | On va utiliser le script d' | + | # activate link_token method in the ip_limit method |
| - | <code bash> | + | link_token = true |
| - | sudo -s | + | |
| - | sudo / | + | |
| </ | </ | ||
| - | Choisissez les réponses par défaut à chaque question. | + | Redémarrez |
| - | ===== uWSGI ===== | + | |
| - | + | ||
| - | uWSGI va nous permettre de démarrer l' | + | |
| - | + | ||
| - | Créez | + | |
| - | <code bash> | + | |
| - | + | ||
| - | Collez-y les lignes suivantes | + | |
| <code bash> | <code bash> | ||
| - | # -*- mode: conf; coding: utf-8 -*- | + | sudo docker compose down |
| - | [uwsgi] | + | sudo docker compose up -d |
| - | + | ||
| - | # uWSGI core | + | |
| - | # ---------- | + | |
| - | # | + | |
| - | # https:// | + | |
| - | + | ||
| - | # Who will run the code / Hint: in emperor-tyrant mode uid & gid setting will be | + | |
| - | # ignored [1]. Mode emperor-tyrant is the default on fedora (/ | + | |
| - | # | + | |
| - | # [1] https:// | + | |
| - | # | + | |
| - | uid = searxng | + | |
| - | gid = searxng | + | |
| - | + | ||
| - | # 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 = / | + | |
| - | + | ||
| - | # SearXNG configuration (settings.yml) | + | |
| - | env = SEARXNG_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 | + | |
| - | # ----------------- | + | |
| - | + | ||
| - | socket = / | + | |
| - | buffer-size = 8192 | + | |
| - | + | ||
| - | # uWSGI serves the static files and in settings.yml we use:: | + | |
| - | # | + | |
| - | # ui: | + | |
| - | # | + | |
| - | # | + | |
| - | static-map = / | + | |
| - | # expires set to one year since there are hashes | + | |
| - | static-expires = /* 31557600 | + | |
| - | static-gzip-all = True | + | |
| - | offload-threads = %k | + | |
| - | + | ||
| - | # Cache | + | |
| - | cache2 = name=searxngcache, | + | |
| </ | </ | ||
| - | |||
| - | Activez le lancement au démarrage de Searx : | ||
| - | <code bash> | ||
| - | |||
| - | Démarrez Searx : | ||
| - | <code bash> | ||
| ===== Configuration d' | ===== Configuration d' | ||
| Ligne 272: | Ligne 123: | ||
| <code bash> | <code bash> | ||
| - | Copiez-y les lignes suivantes (remplacez le noom de domaine par le vôtre ainsi que l' | + | Copiez-y les lignes suivantes (remplacez le nom de domaine par le vôtre ainsi que l' |
| <code apache> | <code apache> | ||
| < | < | ||
| - | ServerName searx.nomdedomaine.fr | + | ServerName searx.domaine.fr |
| - | Redirect / https:// | + | Redirect / https:// |
| </ | </ | ||
| + | |||
| < | < | ||
| - | | + | |
| + | | ||
| LogLevel warn | LogLevel warn | ||
| - | ErrorLog ${APACHE_LOG_DIR}/ | + | ErrorLog ${APACHE_LOG_DIR}/ |
| Ligne 293: | Ligne 146: | ||
| ProxyRequests Off | ProxyRequests Off | ||
| ProxyPreserveHost On | ProxyPreserveHost On | ||
| - | SSLCertificateFile / | + | SSLCertificateFile / |
| - | SSLCertificateKeyFile / | + | SSLCertificateKeyFile / |
| AddDefaultCharset utf-8 | AddDefaultCharset utf-8 | ||
| HostnameLookups off | HostnameLookups off | ||
| Ligne 300: | Ligne 153: | ||
| ProxyBadHeader Ignore | ProxyBadHeader Ignore | ||
| KeepAlive off | KeepAlive off | ||
| - | Header set Content-Security-Policy " | + | |
| - | + | ProxyPass | |
| - | | + | < |
| - | ProxyPass / unix:/ | + | ProxyPassReverse http://localhost:8085/ |
| + | | ||
| + | | ||
| # see limiter.py | # see limiter.py | ||
| - | RequestHeader set X-Real-IP %{REMOTE_ADDR}s | + | |
| - | RequestHeader append X-Forwarded-For %{REMOTE_ADDR}s | + | |
| + | |||
| + | # intermediate configuration | ||
| + | SSLProtocol | ||
| + | SSLOpenSSLConfCmd | ||
| + | SSLCipherSuite | ||
| + | SSLHonorCipherOrder | ||
| + | SSLSessionTickets | ||
| + | # enable HTTP/2, if available | ||
| + | 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 set X-XSS-Protection "1; mode=block" | ||
| + | Header unset X-Powered-By | ||
| + | Header set Referrer-Policy: | ||
| + | Header set Permissions-Policy " | ||
| + | Header set Content-Security-Policy " | ||
| + | </ | ||
| </ | </ | ||
| + | |||
| </ | </ | ||
| Ligne 318: | Ligne 195: | ||
| Votre instance SearXNG est maintenant accessible à l' | Votre instance SearXNG est maintenant accessible à l' | ||
| - | |||
| - | ===== Mise à jour de SearXNG ===== | ||
| - | |||
| - | Pour mettre à jour votre instance, il vous suffit de lancer la commande suivante : | ||
| - | <code bash> | ||
| - | |||