#!/usr/bin/env bash set -euo pipefail ensure_root detect_pkg_manager pkg_install curl $SUDO mkdir -p /srv/docker/nginx-php/www cd /srv/docker/nginx-php if [ ! -f /srv/docker/nginx-php/www/index.php ]; then $SUDO tee /srv/docker/nginx-php/www/index.php >/dev/null </dev/null <<'EOF' services: php: image: php:8.2-fpm container_name: nginx-php_php volumes: - ./www:/var/www/html nginx: image: nginx:latest container_name: nginx-php_nginx ports: - "80:80" volumes: - ./www:/var/www/html - ./nginx.conf:/etc/nginx/conf.d/default.conf depends_on: - php EOF if [ ! -f nginx.conf ]; then $SUDO tee nginx.conf >/dev/null <<'EOF' server { listen 80; server_name _; root /var/www/html; index index.php index.html; location / { try_files $uri /index.php?$args; } location ~ \.php$ { fastcgi_pass php:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } EOF fi $SUDO docker compose up -d log "NGINX + PHP erfolgreich installiert. Öffne http:///"