1. The problem I’m having:
I’m really new to all this so I’m very grateful for any hints or tips you can give me here! I’ve bought a domain and a virtual server (with full root access to it) running AlmaLinux 9 to set up an environment for a Shopware 6 installation. I’ve successfully connected the domain to the virtual server using DNS A records, pinging the domain returns the correct IP address. Before setting up Shopware, I want to see the output of a simple index.php script showing the servers configuration. There is probably lots of errors and things missing but as I’ve said I’m still learning, I really want to get this thing going, I’ve always wanted to run my own server.
2. Error messages and/or full log output:
curl -vL run from a WSL Ubuntu 22.04.3 LTS on Windows 11
curl -vL vanill.at
* Trying 185.164.4.42:80...
* connect to 185.164.4.42 port 80 failed: Connection refused
* Failed to connect to vanill.at port 80 after 9 ms: Connection refused
* Closing connection 0
curl: (7) Failed to connect to vanill.at port 80 after 9 ms: Connection refused
3. Caddy version:
caddy:latest
4. How I installed and ran Caddy:
Set up folders and docker-compose.yaml
-
/lcmp
/lcmp/docker-compose.yaml -
/lcmp/caddy_docker
/Dockerfile (see below) -
/lcmp/php_docker
/Dockerfile (see below) -
/www
/www/index.php
index.php in /lcmp/www
<?php phpinfo(); ?>
Dockerfile inside /lcmp/caddy_docker here
# Use the official Caddy Docker image
FROM caddy:latest
# Update package index and upgrade installed packages
RUN apk update && apk upgrade
# Copy Caddyfile to configure Caddy server
COPY Caddyfile /etc/caddy/Caddyfile
a. System environment:
AlmaLinux 9 running on a virtual server
uname -a
Linux ebvyvs.myvserver.online 5.14.0 #1 SMP Wed Jul 12 12:00:44 MSK 2023 x86_64 x86_64 x86_64 GNU/Linux
Dockerfile in /lcmp/php_docker
FROM php:8.2-fpm-alpine
# Downloading install-php-extensions script and making it executable
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions>
RUN chmod +x /usr/local/bin/install-php-extensions
# Installing PHP extensions using install-php-extensions script
RUN install-php-extensions \
mysqli \
pdo \
pdo_mysql \
gd \
zip \
intl \
xml \
curl \
dom \
fileinfo \
iconv \
json \
libxml \
mbstring \
openssl \
pcre \
phar \
simplexml \
zlib
# Cleaning APK cache
RUN rm -rf /var/cache/apk/*
b. Command:
docker compose up -d
[+] Running 0/1
⠸ Network lcmp_default Created 1.4s
[+] Running 4/5d orphan containers ([lcmp-apache-1]) for this project. If you removed or renamed this service ⠋ Network lcmp_default Created 4.0s
✔ Container lcmp-mariadb-1 Started 1.4s
✔ Container lcmp-php-1 Started 1.4s
✔ Container lcmp-caddy-1 Started 2.4s
✔ Container lcmp-phpmyadmin-1 Started 2.1s
Although docker compose up-d says lcmp-caddy-1 has been started, I do not see it here
docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
lcmp-mariadb-1 mariadb:10.11 "docker-entrypoint.s…" mariadb About a minute ago Up About a minute 3306/tcp
lcmp-php-1 lcmp-php "docker-php-entrypoi…" php About a minute ago Up About a minute 9000/tcp
lcmp-phpmyadmin-1 phpmyadmin/phpmyadmin:latest "/docker-entrypoint.…" phpmyadmin About a minute ago Up About a minute 0.0.0.0:8080->80/tcp, :::8080->80/tcp
docker compose logs -f
mariadb-1 | 2024-02-23 19:52:05+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.7+maria~ubu2204 started.
mariadb-1 | 2024-02-23 19:52:06+00:00 [Warn] [Entrypoint]: /sys/fs/cgroup/devices:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 12:perf_event:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 11:cpuacct,cpu:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 10:cpuset:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 9:freezer:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 7:hugetlb:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 6:net_prio,net_cls:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 5:name=systemd:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 3:pids:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 2:memory:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c
mariadb-1 | 1:blkio:/docker/c8115f4ef0900bba4a6945d86a7db6e89a46aaba235f14f565b8304d36084c4c/memory.pressure not writable, functionality unavailable to MariaDB
mariadb-1 | 2024-02-23 19:52:06+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mariadb-1 | 2024-02-23 19:52:06+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.11.7+maria~ubu2204 started.
mariadb-1 | 2024-02-23 19:52:06+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
mariadb-1 | 2024-02-23 19:52:06 0 [Note] Starting MariaDB 10.11.7-MariaDB-1:10.11.7+maria~ubu2204 source revision 87e13722a95af5d9378d990caf48cb6874439347 as process 1
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Using transactional memory
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Number of transaction pools: 1
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
mariadb-1 | 2024-02-23 19:52:06 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Completed initialization of buffer pool
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Buffered log writes (block size=512 bytes)
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: End of log at LSN=46846
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: 128 rollback segments are active.
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: log sequence number 46846; transaction id 14
mariadb-1 | 2024-02-23 19:52:06 0 [Note] Plugin 'FEEDBACK' is disabled.
mariadb-1 | 2024-02-23 19:52:06 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
mariadb-1 | 2024-02-23 19:52:06 0 [Note] Server socket created on IP: '0.0.0.0'.
mariadb-1 | 2024-02-23 19:52:06 0 [Note] Server socket created on IP: '::'.
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mariadb-1 | 2024-02-23 19:52:06 0 [Note] InnoDB: Buffer pool(s) load completed at 240223 19:52:06
mariadb-1 | 2024-02-23 19:52:06 0 [Note] mariadbd: ready for connections.
mariadb-1 | Version: '10.11.7-MariaDB-1:10.11.7+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
php-1 | [23-Feb-2024 19:52:05] NOTICE: fpm is running, pid 1
php-1 | [23-Feb-2024 19:52:05] NOTICE: ready to handle connections
caddy-1 | {"level":"info","ts":1708717926.808931,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
caddy-1 | Error: adapting config using caddyfile: File to import not found: php_common, at /etc/caddy/Caddyfile:5
phpmyadmin-1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.23.0.4. Set the 'ServerName' directive globally to suppress this message
phpmyadmin-1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.23.0.4. Set the 'ServerName' directive globally to suppress this message
phpmyadmin-1 | [Fri Feb 23 19:52:06.677171 2024] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.57 (Debian) PHP/8.2.8 configured -- resuming normal operations
phpmyadmin-1 | [Fri Feb 23 19:52:06.677263 2024] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
phpmyadmin-1 | 45.79.181.223 - - [23/Feb/2024:19:55:32 +0000] "\x16\x03\x01" 400 484 "-" "-"
docker compose exec caddy-l caddy version
service "caddy-l" is not running
docker compose exec caddy-1 caddy version
service "caddy-1" is not running
c. Service/unit/compose file:
Here is the docker-compose.yaml in /lcmp
version: "3.8"
services:
# PHP Service
php:
build: './php_docker/'
volumes:
- ./www/:/var/www/html/
# Caddy Service
caddy:
build: './caddy_docker/'
depends_on:
- php
ports:
- "80:80"
- "443:443"
volumes:
- ./www/:/var/www/html/
# MariaDB Service
mariadb:
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: <root password redacted>
volumes:
- mysqldata:/var/lib/mysql
# phpMyAdmin Service
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 8080:80
environment:
PMA_HOST: mariadb
depends_on:
- mariadb
# Volumes
volumes:
mysqldata:
Here is the Dockerfile in /lcmp/php_docker
FROM php:8.2-fpm-alpine
# Downloading install-php-extensions script and making it executable
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/install-php-extensions
RUN chmod +x /usr/local/bin/install-php-extensions
# Installing PHP extensions using install-php-extensions script
RUN install-php-extensions \
mysqli \
pdo \
pdo_mysql \
gd \
zip \
intl \
xml \
curl \
dom \
fileinfo \
iconv \
json \
libxml \
mbstring \
openssl \
pcre \
phar \
simplexml \
zlib
# Cleaning APK cache
RUN rm -rf /var/cache/apk/*
d. My complete Caddy config:
vanill.at {
reverse_proxy php:9000 {
import php_common
}
}
(php_common) {
root * /var/www/html
file_server
php_fastcgi php:9000
log {
output stdout
}
}
5. Links to relevant resources:
I’ve used this to set up PHP 8.2 with FPM
https: //github.com/mlocati/docker-php-extension-installer
And this as a blueprint for the folder / file structure
How to Set Up a LAMP Stack with Docker Compose (linuxiac.com)
Here are the requirements of Shopware 6
Requirements | Shopware Documentation