Anpassungen

This commit is contained in:
2020-07-17 14:15:15 +02:00
parent 8e7bcecec8
commit 2f5e708438
8 changed files with 51 additions and 23 deletions

View File

@@ -0,0 +1,15 @@
#h1 Docker Webserver Stack
Ein Webserver stack basierend auf Docker.
#h2 Enthaltene Software
* PHP-FPM 7.4.8 basierend auf Alpine
* Nginx latest basierend auf Alpine
* Mariadb latest basierend auf Alpine
#h2 Konfiguration
Zusätzliche PHP-Pakete müssen in dem Dockerfile angegben werden. Nach löschen des Containers wird dieser
beim erneuten erstellen mit den zusätzlichen Paketen gebaut.

View File

@@ -1,13 +1,11 @@
version: '3.3'
services:
php:
restart: always
build:
context: './docker/php'
ports:
- 9000:9000
volumes:
- './www-data:/var/www'
- './docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf'
- './docker/php/php.ini:/usr/local/etc/php/conf.d/php.override.ini'
- './logs/php:/var/log/php'
environment:
@@ -15,6 +13,7 @@ services:
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
nginx:
restart: always
image: nginx:alpine
ports:
- 8123:80
@@ -25,7 +24,11 @@ services:
depends_on:
- php
mysql:
restart: always
image: mariadb:latest
volumes:
- './docker/mariadb/my.cnf:/etc/mysql/conf.d/db.cnf'
- './logs/mariadb:/var/log/mariadb'
depends_on:
- php
environment:

9
docker/mariadb/my.cnf Normal file
View File

@@ -0,0 +1,9 @@
[mariadb]
# Logging
general_log_file = /var/log/mariadb/mysql.log
general_log = 1
log_warnings = 2
log_error = /var/log/mariadb/mariadb_error.log
slow_query_log_file = /var/log/mariadb/mariadb_slow.log

View File

@@ -1,3 +1,3 @@
FROM php:7.2-fpm
FROM php:7.4.8-fpm-alpine3.12
RUN docker-php-ext-install mysqli

View File

@@ -9,3 +9,4 @@ error_log = /var/log/php/error.log
access_log=/var/log/php/access.log
post_max_size=24M
upload_max_filesize=24M
short_open_tag=On

View File

@@ -1,11 +0,0 @@
[www]
user = www-data
group = www-data
listen = nginx:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

View File

@@ -1,10 +1,21 @@
<?
$host = 'mysql';
$user = getenv('MYSQL_USER');
$pass = getenv('MYSQL_PASSWORD');
$conn = mysqli_connect($host, $user, $pass);
if (!$conn) {
exit('Connection failed: '.mysqli_connect_error().PHP_EOL);
$res = mysql_query("SHOW DATABASES");
while ($row = mysql_fetch_assoc($res)) {
echo $row['Database'] . "\n";
}
echo 'Successful database connection!'.PHP_EOL;
//if (!$conn) {
// exit('Connection failed: '.mysqli_connect_error().PHP_EOL);
//}
//echo 'Successful database connection!'.PHP_EOL;
?>

View File

@@ -1 +1 @@
echo 'Welcome!';
<? phpinfo();?>