dienste:bytecluster0002:wiki

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
dienste:bytecluster0002:wiki [27.12.2020 21:30] mape2kdienste:bytecluster0002:wiki [18.03.2024 22:10] (aktuell) – Bytespider aussperren wegen exzessiven Anfragen, Robots.txt wegen KI-Spidern mape2k
Zeile 13: Zeile 13:
 ===== Dienste ===== ===== Dienste =====
  
-  * FIXME+  * Dokuwiki (via NGINX)
  
 ===== Installation ===== ===== Installation =====
Zeile 22: Zeile 22:
  
   - NGINX und PHP-FPM installieren   - NGINX und PHP-FPM installieren
-    * **sudo apt-get install php7.php7.3-cli php7.3-fpm php7.3-gd php7.3-xml php7.3-zip nginx**+    * **sudo apt-get install php7.php7.4-cli php7.4-fpm php7.4-gd php7.4-xml php7.4-zip php7.4-mbstring nginx**
   - Default-Konfiguration anpassen<file|/etc/nginx/sites-available/default>   - Default-Konfiguration anpassen<file|/etc/nginx/sites-available/default>
 server { server {
Zeile 34: Zeile 34:
  
  server_name _;  server_name _;
 +
 +        # Block Bytespider
 +        if ($http_user_agent ~ (Bytespider|bytedance) ) {
 +                return 403;
 +        }
  
  location / {  location / {
Zeile 61: Zeile 66:
  location ~ \.php$ {   location ~ \.php$ { 
  try_files $uri =404;   try_files $uri =404; 
-                fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; +                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; 
                 fastcgi_index index.php;                  fastcgi_index index.php; 
                 include fastcgi_params;                  include fastcgi_params; 
Zeile 69: Zeile 74:
 </file>  </file> 
   - Dienste aktivieren und neustarten   - Dienste aktivieren und neustarten
-    * **sudo systemctl enable nginx.service php7.3-fpm.service** +    * **sudo systemctl enable nginx.service php7.4-fpm.service** 
-    * **sudo systemctl restart nginx.service php7.3-fpm.service**+    * **sudo systemctl restart nginx.service php7.4-fpm.service**
  
 ==== Dokuwiki ==== ==== Dokuwiki ====
Zeile 80: Zeile 85:
       * Entpacken in das Verzeichnis /var/www/public_html       * Entpacken in das Verzeichnis /var/www/public_html
       * Datenverzeichnis nach /var/www/data (bzw. ../data)       * Datenverzeichnis nach /var/www/data (bzw. ../data)
 +  - Berechtigungen anpassen
 +    * **chown -R www-data:www-data /var/www/{public_html,data}**
   - Cache-Cleanup einrichten   - Cache-Cleanup einrichten
     - Cleanup-Skript<file|/usr/local/bin/cleanup_dokuwiki_cache.sh>     - Cleanup-Skript<file|/usr/local/bin/cleanup_dokuwiki_cache.sh>
 +#!/bin/bash
 +
 +cleanup()
 +{
 +    local data_path="$1"        # full path to data directory of wiki
 +    local retention_days="$2"   # number of days after which old files are to be removed
 +
 +    # remove stale lock files (files which are 1-2 days old)
 +    find "${data_path}"/locks/ -name '*.lock' -type f -mtime +1 -delete
 +
 +    # remove files older than ${retention_days} days from the cache
 +    find "${data_path}"/cache/ -type f -mtime +${retention_days} -delete
 +}
 +
 +# cleanup DokuWiki installations (path to datadir, number of days)
 +cleanup /var/www/data    180
 </file> </file>
     - Cleanup-Skript ausführbar machen     - Cleanup-Skript ausführbar machen
Zeile 87: Zeile 110:
     - Cleanup-Skript als Cronjob einrichten machen     - Cleanup-Skript als Cronjob einrichten machen
       * **<nowiki>echo -e "0 2 * * *\troot\t/usr/local/bin/cleanup_dokuwiki_cache.sh" | sudo tee /etc/cron.d/dokwiki > /dev/null/<nowiki>**       * **<nowiki>echo -e "0 2 * * *\troot\t/usr/local/bin/cleanup_dokuwiki_cache.sh" | sudo tee /etc/cron.d/dokwiki > /dev/null/<nowiki>**
 +
 +=== robots.txt ===
 +
 +Quelle: https://neil-clarke.com/block-the-bots-that-feed-ai-models-by-scraping-your-website/
 +
 +  - Robots.txt setzen<file|/var/www/public_html/robots.txt>
 +User-agent: CCBot
 +Disallow: /
 +
 +User-agent: ChatGPT-User
 +Disallow: /
 +
 +User-agent: GPTBot
 +Disallow: /
 +
 +User-agent: Google-Extended
 +Disallow: /
 +
 +User-agent: anthropic-ai
 +Disallow: /
 +
 +User-agent: Omgilibot
 +Disallow: /
 +
 +User-agent: Omgili
 +Disallow: /
 +
 +User-agent: FacebookBot
 +Disallow: /
 +
 +User-agent: Bytespider
 +Disallow: /
 +
 +User-agent: ImagesiftBot 
 +Disallow: /
 +</file>
 +  - Berechtigungen anpassen
 +    * **chown www-data:www-data /var/www/public_html/robots.txt**
 +
 ==== Backup mit Borgmatic ==== ==== Backup mit Borgmatic ====
  
Zeile 99: Zeile 161:
         - /home         - /home
         - /root         - /root
 +        - /usr/local
         - /var/log         - /var/log
         - /var/www         - /var/www
 ... ...
 </file> </file>
  • dienste/bytecluster0002/wiki.1609101010.txt.gz
  • Zuletzt geändert: 27.12.2020 21:30
  • von mape2k