I. Webserver (apache2 oder nginx)
Installiere den Webserver apache2:
# apt install apache2
oder alternativ nginx als Webserver:
# apt install nginx

II: php-Server (apache2)
Falls Module oder Erweiterungen fehlen, können diese immer noch nachinstalliert werden. Einige Module wie mod_rewrite werden mit a2enmod rewrite erst aktiviert:
# apt install php7.4
# apt install php-modul_1 php-modul_2 php-modul_3 php-modul_4...
Um z. B. Nextcloud zu betreiben, sind folgende Module notwendig:
# apt install php-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php-gmp php-intl php-imagick php-bcmath php-zip
Welche PHP-Version schlussendlich auf dem lokalen Server landet, hängt u.a. mit der Version von Debian ab. Aktuell (März 2022) bekommt Debian Bullseye die php-Version 7.4. Um dauerhaft Besitzer eines Verzeichnis zu werden, kann per chown der Besitzer gewechselt werden:
# chown -cR BENUTZERNAME /var/www/html/ordnername
Den Status vom Web- oder dem Datenbankserver rufst du per systemctl status dienstname auf:
$ systemctl status apache2 $ systemctl status mariadb
II: php-Server (nginx)
Falls beim Webserver die Option nginx gewählt wurde, implementieren wir die php-Erweiterung mittels php-fpm:
# apt install php-fpm # ls /var/run/php/php7.4-fpm.sock
Um php-fpm anzuwenden, muss das PHP-Script unter
# nano /etc/nginx/sites-available/default
auskommentiert werden. Entferne dazu die Kommentarzeichen # und achte drauf, die geschweiften Klammern auch zu schliessen:
server {
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name example.com; # managed by Certbot
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
}
Geprüft wird der php-Server mittels info.php
echo "<?php phpinfo(); ?>" | tee /var/www/html/info.php
Starte nginx neu und rufe die info.php auf:
# nginx -t # systemctl reload nginx
III. Datenbankserver MariaDB
Installiere MariaDB:
# apt install default-mysql-server mariadb-server
III. Datenbankserver PostgreSQL
oder alternativ PostgreSQL als Datenbankserver:
Hinzufügen vom Repository # sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' Schlüssel beziehen: # wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - Paketquelle aktuallisieren: # apt-get update PostgrSQL installieren # apt install postgresql
Hinweis: WordPress benötigt bei der Verwendung vom PostgreSQL ein zusätzliches Plugin, welches via git unter wp-content installiert werden muss:
# apt install php-pgsql # apt install git $ cd /var/www/html/wp-content $ git clone https://github.com/kevinoid/postgresql-for-wordpress.git $ mv postgresql-for-wordpress/pg4wp pg4wp $ cp pg4wp/db.php db.php