Inhaltsverzeichnis

Container 'paste'

Ressourcen

System

Dienste

Installation

NGINX / PHP

  1. NGINX und PHP-FPM installieren
    • sudo apt-get install php8.2 php8.2-fpm php8.2-mbstring php8.2-mysql nginx
  2. Default-Konfiguration anpassen

    /etc/nginx/sites-available/default

    server {
    	listen 80 default_server;
    	listen [::]:80 default_server;
    
    root /var/www/public_html;
    
    	# Add index.php to the list if you are using PHP
    	index index.php
    
    	server_name _;
    
    	location / {
    		try_files $uri $uri/ index.php;
    		if ( !-e $request_filename ) {
    			rewrite ^/(.*)$ /index.php;
    		}
    	}
    
    	# pass PHP scripts to FastCGI server
    	location ~ \.php$ { 
    		try_files $uri =404; 
    		fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; 
    		fastcgi_index index.php; 
    		include fastcgi_params; 
    		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    	}
    
    	# Do not log access to images
    	location ~ ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
    		expires 30d;
    		access_log off;
    	}
    }
  3. Dienste aktivieren und neustarten
    • sudo systemctl enable nginx.service php8.2-fpm.service
    • sudo systemctl restart nginx.service php8.2-fpm.service

Paste

  1. Herunterladen und entpacken
  2. Datenbank erstellen
  3. Konfigurations-Sample erzeugen
    • sudo cp /var/www/public_html/classes/Config.php.example /var/www/public_html/classes/Config.php
  4. Konfiguration anpassen

    /var/www/public_html/classes/Config.php

    <?php
    class Config {
    	public static $paths = [
    		'url'    => 'https://paste.technikkultur-erfurt.de',
    		'base'   => '',
    		'index'  => '/index.php',
    		'views'  => 'views/',
    		'assets' => '/assets/',
    		'pastes' => '/var/www/public_html/pastes/',
    		'help'   => '/sa6o5irjtbhk',
    	];
    
    	public static $mysql = [
    		'host'   => '10.3.0.100',
    		'user'   => 'paste',
    		'pass'   => 'XXXXXX',
    		'db'     => 'paste'
    	];
    
    	# leave this empty to use mysql
    	# be sure to put this in a save location
    	public static $sqlite = null;
    
    	public static $table = 'paste';
    
    	public static $db;
    
    	public static $site_name = 'Technikkultur in Erfurt - Paste';
    Hinweis: help muss angepasst werden, wenn die Hilfeseite als Paste erzeugt wurde.
  5. Berechtigungen anpassen
    • sudo chown -R www-data:www-data /var/www/public_html

Backup mit Borgmatic

  1. Installation siehe mariadb
  2. Konfiguration

    /etc/borgmatic/config.yaml

    ...
    location:
        # List of source directories to backup (required). Globs and
        # tildes are expanded.
        source_directories:
            - /etc
            - /home
            - /root
            - /var/log
            - /var/www
    ...