Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
GamerClassN7 committed Oct 21, 2020
1 parent aa08c51 commit 0ee345e
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apache/Dockerfile
@@ -0,0 +1,12 @@
FROM httpd:2.4.33-alpine

RUN apk update; \
apk upgrade;

RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf

# Copy apache vhost file to proxy php requests to php-fpm container
COPY apache.conf /usr/local/apache2/conf/apache.conf
RUN echo "Include /usr/local/apache2/conf/apache.conf" \
>> /usr/local/apache2/conf/httpd.conf

24 changes: 24 additions & 0 deletions apache/apache.conf
@@ -0,0 +1,24 @@
ServerName localhost

LogLevel trace8

LoadModule deflate_module /usr/local/apache2/modules/mod_deflate.so
LoadModule proxy_module /usr/local/apache2/modules/mod_proxy.so
LoadModule proxy_fcgi_module /usr/local/apache2/modules/mod_proxy_fcgi.so
LoadModule rewrite_module /usr/local/apache2/modules/mod_rewrite.so

<VirtualHost *:80>
# Proxy .php requests to port 9000 of the php-fpm container
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/var/www/html/$1
DocumentRoot /var/www/html/
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

# Send apache logs to stdout and stderr
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog /var/log/apache2/acess.log common
ErrorLog /var/log/apache2/error.log
</VirtualHost>
46 changes: 46 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,46 @@
version: "3.2"
services:
php:
build: './php/'
networks:
- backend
volumes:
- ..:/var/www/html/
- ./logs/mysql/:/var/log/mysql/
apache:
build: './apache/'
depends_on:
- php
- mysql
networks:
- frontend
- backend
ports:
- "8080:80"
volumes:
- ../:/var/www/html/
- ./logs/apache/:/var/log/apache2/
mysql:
image: mysql:5.6.40
networks:
- backend
environment:
- MYSQL_ROOT_PASSWORD=rootpassword
phpmyadmin:
image: phpmyadmin/phpmyadmin:5.0.1
restart: always
depends_on:
- php
- mysql
networks:
- frontend
- backend
environment:
PMA_HOST: mysql
PMA_USER: root
PMA_PASSWORD: rootpassword
ports:
- "8081:80"
networks:
frontend:
backend:
4 changes: 4 additions & 0 deletions php/Dockerfile
@@ -0,0 +1,4 @@
FROM php:7.2.7-fpm-alpine3.7
RUN apk update; \
apk upgrade;
RUN docker-php-ext-install mysqli
12 changes: 12 additions & 0 deletions php/www.conf
@@ -0,0 +1,12 @@
[www]

user = www-data
group = www-data

listen = apache2:9000

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

0 comments on commit 0ee345e

Please sign in to comment.