version: '2.3'
services:
web:
image: php:7.2-apache
ports:
- 8181:80
volumes:
- ./src:/var/www/html
db:
image: mysql:5.7
command: --default-authentication-plugin=mysql_native_password
volumes:
- ./db_data:/var/lib/mysql
ports:
- 3307:3306
environment:
MYSQL_DATABASE: login
MYSQL_USER: login
MYSQL_PASSWORD: root
MYSQL_RANDOM_ROOT_PASSWORD: '1'
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
ports:
- 8282:80
environment:
PMA_HOST: db
# Включаем mod_rewrite
RewriteEngine On
# Убираем последний слеш
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Преобразуем /pages/about.php в /about
RewriteRule ^(\w+)$ /pages/$1.php [L,NC]
# Dockerfile
FROM php:7.2-apache
RUN a2enmod rewrite
docker-compose up --build