From 9c4b2dbbb76c3e038bfc05ce42074fcd0a0faa9d Mon Sep 17 00:00:00 2001 From: Rail Hamdeev Date: Mon, 17 Oct 2022 12:00:03 +0600 Subject: [PATCH] added Apache PHP 8.1 --- .github/workflows/dockerimage.yml | 24 ++++--- README.md | 2 +- README_ru.md | 2 +- docker/apache-php-81/build/Dockerfile | 2 + docker/apache-php-81/composer/.htaccess | 1 + docker/apache-php-81/composer/cache/.htaccess | 1 + docker/apache-php-81/config/apache2.conf | 35 ++++++++++ docker/apache-php-81/config/msmtprc | 4 ++ docker/apache-php-81/config/php.ini | 14 ++++ .../config/sites-enabled/default.conf | 7 ++ .../config/templates/site.test.conf | 5 ++ .../templates/site.test.conf-apache-php-81 | 27 ++++++++ templates/docker-compose-apache-php-81.yml | 65 +++++++++++++++++++ 13 files changed, 179 insertions(+), 10 deletions(-) create mode 100644 docker/apache-php-81/build/Dockerfile create mode 100644 docker/apache-php-81/composer/.htaccess create mode 100644 docker/apache-php-81/composer/cache/.htaccess create mode 100644 docker/apache-php-81/config/apache2.conf create mode 100644 docker/apache-php-81/config/msmtprc create mode 100644 docker/apache-php-81/config/php.ini create mode 100644 docker/apache-php-81/config/sites-enabled/default.conf create mode 100644 docker/apache-php-81/config/templates/site.test.conf create mode 100644 docker/nginx/config/templates/site.test.conf-apache-php-81 create mode 100644 templates/docker-compose-apache-php-81.yml diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index eefee81..e3bdfed 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -90,6 +90,22 @@ jobs: run: make st + - name: Build the stack Apache PHP-81 and hack with default.conf + run: cp mysql.env.example mysql.env && cp docker/nginx/config/templates/site.test.conf-apache-php-81 docker/nginx/config/default.conf && sed -i 's/server_name site.test/server_name _/g' docker/nginx/config/default.conf && cp docker/apache-php-81/config/templates/site.test.conf docker/apache-php-81/config/sites-enabled/default.conf && sed -i 's/ServerName site.test/ /g' docker/apache-php-81/config/sites-enabled/default.conf && cp templates/docker-compose-apache-php-81.yml docker-compose.yml && make upb + - name: Test Nginx localhost + run: docker run --network container:docker-compose-php_nginx_1 appropriate/curl -s --retry 1 --retry-connrefused http://super:demo@localhost/ | grep '8.1' + - name: Stop containers + run: make st + + + - name: Build the stack Apache PHP-74 and hack with default.conf + run: cp mysql.env.example mysql.env && cp docker/nginx/config/templates/site.test.conf-apache-php-74 docker/nginx/config/default.conf && sed -i 's/server_name site.test/server_name _/g' docker/nginx/config/default.conf && cp docker/apache-php-74/config/templates/site.test.conf docker/apache-php-74/config/sites-enabled/default.conf && sed -i 's/ServerName site.test/ /g' docker/apache-php-74/config/sites-enabled/default.conf && cp templates/docker-compose-apache-php-74.yml docker-compose.yml && make upb + - name: Test Nginx localhost + run: docker run --network container:docker-compose-php_nginx_1 appropriate/curl -s --retry 1 --retry-connrefused http://super:demo@localhost/ | grep '7.4' + - name: Stop containers + run: make st + + - name: Build the stack Apache PHP-71 and hack with default.conf run: cp mysql.env.example mysql.env && cp docker/nginx/config/templates/site.test.conf-apache-php-71 docker/nginx/config/default.conf && sed -i 's/server_name site.test/server_name _/g' docker/nginx/config/default.conf && cp docker/apache-php-71/config/templates/site.test.conf docker/apache-php-71/config/sites-enabled/default.conf && sed -i 's/ServerName site.test/ /g' docker/apache-php-71/config/sites-enabled/default.conf && cp templates/docker-compose-apache-php-71.yml docker-compose.yml && make upb - name: Test Nginx localhost @@ -104,11 +120,3 @@ jobs: run: docker run --network container:docker-compose-php_nginx_1 appropriate/curl -s --retry 1 --retry-connrefused http://super:demo@localhost/ | grep '5.6' - name: Stop containers run: make st - - - - name: Build the stack Apache PHP-74 and hack with default.conf - run: cp mysql.env.example mysql.env && cp docker/nginx/config/templates/site.test.conf-apache-php-74 docker/nginx/config/default.conf && sed -i 's/server_name site.test/server_name _/g' docker/nginx/config/default.conf && cp docker/apache-php-74/config/templates/site.test.conf docker/apache-php-74/config/sites-enabled/default.conf && sed -i 's/ServerName site.test/ /g' docker/apache-php-74/config/sites-enabled/default.conf && cp templates/docker-compose-apache-php-74.yml docker-compose.yml && make upb - - name: Test Nginx localhost - run: docker run --network container:docker-compose-php_nginx_1 appropriate/curl -s --retry 1 --retry-connrefused http://super:demo@localhost/ | grep '7.4' - - name: Stop containers - run: make st diff --git a/README.md b/README.md index 059be8e..31edb93 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Nginx + MariaDB + MailHog + PHP-7.1/7.2/7.3/7.4/8.0/8.1 FPM + Apache mod-php 5.6/7.1/7.4 +## Nginx + MariaDB + MailHog + PHP-7.1/7.2/7.3/7.4/8.0/8.1 FPM + Apache mod-php 5.6/7.1/7.4/8.1 ![](https://github.com/rhamdeew/docker-compose-php/workflows/Docker%20Image%20CI/badge.svg) diff --git a/README_ru.md b/README_ru.md index 0ab41e3..0020ee8 100644 --- a/README_ru.md +++ b/README_ru.md @@ -1,4 +1,4 @@ -## Nginx + MariaDB + MailHog + PHP-7.1/7.2/7.3/7.4/8.0/8.1 FPM + Apache mod-php 5.6/7.1/7.4 +## Nginx + MariaDB + MailHog + PHP-7.1/7.2/7.3/7.4/8.0/8.1 FPM + Apache mod-php 5.6/7.1/7.4/8.1 ![](https://github.com/rhamdeew/docker-compose-php/workflows/Docker%20Image%20CI/badge.svg) diff --git a/docker/apache-php-81/build/Dockerfile b/docker/apache-php-81/build/Dockerfile new file mode 100644 index 0000000..dfefa40 --- /dev/null +++ b/docker/apache-php-81/build/Dockerfile @@ -0,0 +1,2 @@ +FROM rhamdeew/docker-apache-php-81 +#RUN usermod -u 1050 www-data && groupmod -g 1050 www-data diff --git a/docker/apache-php-81/composer/.htaccess b/docker/apache-php-81/composer/.htaccess new file mode 100644 index 0000000..14249c5 --- /dev/null +++ b/docker/apache-php-81/composer/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/docker/apache-php-81/composer/cache/.htaccess b/docker/apache-php-81/composer/cache/.htaccess new file mode 100644 index 0000000..14249c5 --- /dev/null +++ b/docker/apache-php-81/composer/cache/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/docker/apache-php-81/config/apache2.conf b/docker/apache-php-81/config/apache2.conf new file mode 100644 index 0000000..01d57d2 --- /dev/null +++ b/docker/apache-php-81/config/apache2.conf @@ -0,0 +1,35 @@ +DefaultRuntimeDir ${APACHE_RUN_DIR} +PidFile ${APACHE_PID_FILE} +Timeout 300 +KeepAlive On +MaxKeepAliveRequests 100 +KeepAliveTimeout 5 +User ${APACHE_RUN_USER} +Group ${APACHE_RUN_GROUP} +HostnameLookups Off +ErrorLog ${APACHE_LOG_DIR}/error.log +LogLevel error +IncludeOptional mods-enabled/*.load +IncludeOptional mods-enabled/*.conf +Include ports.conf + + + Options -Indexes +FollowSymLinks + AllowOverride All + Require all granted + + +AccessFileName .htaccess + + + Require all denied + + +LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined +LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %O" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent + +IncludeOptional conf-enabled/*.conf +IncludeOptional sites-enabled/*.conf diff --git a/docker/apache-php-81/config/msmtprc b/docker/apache-php-81/config/msmtprc new file mode 100644 index 0000000..a5cd4be --- /dev/null +++ b/docker/apache-php-81/config/msmtprc @@ -0,0 +1,4 @@ +account mailhog +host mailhog +port 1025 +from test@test.ru \ No newline at end of file diff --git a/docker/apache-php-81/config/php.ini b/docker/apache-php-81/config/php.ini new file mode 100644 index 0000000..287045e --- /dev/null +++ b/docker/apache-php-81/config/php.ini @@ -0,0 +1,14 @@ +date.timezone = "Europe/Moscow" +post_max_size=100M +upload_max_filesize=100M +;display_errors = On +sendmail_path = "/usr/bin/msmtp -a mailhog -t" + +;Bitrix +realpath_cache_size = 4096K +mbstring.func_overload = 2 +mbstring.internal_encoding = utf-8 +opcache.revalidate_freq = 0 +max_input_vars = 10000 +memory_limit = 512M + diff --git a/docker/apache-php-81/config/sites-enabled/default.conf b/docker/apache-php-81/config/sites-enabled/default.conf new file mode 100644 index 0000000..25b9967 --- /dev/null +++ b/docker/apache-php-81/config/sites-enabled/default.conf @@ -0,0 +1,7 @@ + + ServerAdmin webmaster@localhost + DocumentRoot /srv/projects/default + + #ErrorLog /srv/logs/error.log + #CustomLog /srv/logs/access.log combined + diff --git a/docker/apache-php-81/config/templates/site.test.conf b/docker/apache-php-81/config/templates/site.test.conf new file mode 100644 index 0000000..2cc32e1 --- /dev/null +++ b/docker/apache-php-81/config/templates/site.test.conf @@ -0,0 +1,5 @@ + + ServerAdmin webmaster@localhost + ServerName site.test + DocumentRoot /srv/projects/site.test + diff --git a/docker/nginx/config/templates/site.test.conf-apache-php-81 b/docker/nginx/config/templates/site.test.conf-apache-php-81 new file mode 100644 index 0000000..0eedb0f --- /dev/null +++ b/docker/nginx/config/templates/site.test.conf-apache-php-81 @@ -0,0 +1,27 @@ +server { + listen 80; + + #имя сервера: + server_name site.test; + + # корневая директория + root /srv/projects/site.test; + include conf.d/includes/restrictions.inc; + + satisfy any; + allow 192.168.1.0/24; + deny all; + auth_basic "Restricted"; + auth_basic_user_file .htpasswd; + + ###################################### + # Apache config + ###################################### + location / { + proxy_pass http://apache-php-81; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + } + include conf.d/includes/assets.inc; +} diff --git a/templates/docker-compose-apache-php-81.yml b/templates/docker-compose-apache-php-81.yml new file mode 100644 index 0000000..84db381 --- /dev/null +++ b/templates/docker-compose-apache-php-81.yml @@ -0,0 +1,65 @@ +version: '3.4' +x-logging: + &default-logging + driver: "json-file" + options: + max-file: "5" + max-size: "20m" + +services: + + mailhog: + image: mailhog/mailhog + restart: unless-stopped + #ports: + # - '127.0.0.1:1025:1025' + logging: *default-logging + + db: + image: mariadb + restart: unless-stopped + env_file: + - mysql.env + volumes: + # - ./docker/mariadb/config:/etc/mysql/conf.d:ro + - ./db/data:/var/lib/mysql + #ports: + # - '127.0.0.1:3306:3306' + logging: *default-logging + + nginx: + build: ./docker/nginx/build + image: nginx + restart: unless-stopped + volumes: + - ./docker/nginx/.htpasswd:/etc/nginx/.htpasswd:ro + - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - ./docker/nginx/config:/etc/nginx/conf.d:ro + - ./projects:/srv/projects + - ./docker/nginx/acme-challenge:/usr/share/nginx/html:ro + # - ./docker/nginx/ssl:/etc/nginx/ssl:ro + ports: + - "80:80" + # -"443:443" + - "8025:8025" + - "8080:8080" + logging: *default-logging + + adminer: + image: adminer + restart: unless-stopped + + apache-php-81: + build: ./docker/apache-php-81/build + image: apache-php-81 + restart: unless-stopped + env_file: + - mysql.env + volumes: + - ./docker/apache-php-81/config/msmtprc:/etc/msmtprc:ro + - ./docker/apache-php-81/config/php.ini:/usr/local/etc/php/conf.d/my.ini:ro + - ./docker/apache-php-81/config/apache2.conf:/etc/apache2/apache2.conf:ro + - ./docker/apache-php-81/config/sites-enabled:/etc/apache2/sites-enabled:ro + - ./docker/apache-php-81/composer/:/root/.composer/ + - ./projects/:/srv/projects/ + logging: *default-logging