mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
add dev docker with nginx for php 7.4 and 8.1
This commit is contained in:
parent
42f9bf622e
commit
07e41b7da3
16 changed files with 277 additions and 0 deletions
5
docker/dev/_nginx/Dockerfile-nginx
Normal file
5
docker/dev/_nginx/Dockerfile-nginx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
FROM nginx:latest
|
||||
|
||||
COPY default.conf /etc/nginx/conf.d/
|
||||
|
||||
VOLUME /var/www/html
|
||||
58
docker/dev/_nginx/default.conf
Normal file
58
docker/dev/_nginx/default.conf
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# format like 'main' excluding user agent
|
||||
log_format mtt '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer"';
|
||||
access_log off;
|
||||
|
||||
upstream fpm {
|
||||
server php-fpm:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/html; # same as php-fpm
|
||||
|
||||
access_log /var/log/nginx/access.log mtt;
|
||||
|
||||
index index.php index.html;
|
||||
autoindex off;
|
||||
|
||||
location = /phpinfo {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/phpinfo/phpinfo.php;
|
||||
fastcgi_pass fpm;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
rewrite ^/api/(.*) /api.php/$1 last;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
if (!-f $document_root$fastcgi_script_name) {
|
||||
return 404;
|
||||
}
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_pass fpm;
|
||||
}
|
||||
|
||||
location /db/ {
|
||||
return 404; #deny all
|
||||
}
|
||||
|
||||
location /includes/ {
|
||||
return 404; #deny all
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
return 404; #deny all
|
||||
}
|
||||
|
||||
}
|
||||
3
docker/dev/mtt-php74-apache/phpinfo.conf
Normal file
3
docker/dev/mtt-php74-apache/phpinfo.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# mod_alias is required
|
||||
|
||||
Alias "/phpinfo" "/var/www/phpinfo/phpinfo.php"
|
||||
3
docker/dev/mtt-php74-apache/phpinfo.php
Normal file
3
docker/dev/mtt-php74-apache/phpinfo.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
phpinfo();
|
||||
1
docker/dev/mtt-php74-nginx/.env
Normal file
1
docker/dev/mtt-php74-nginx/.env
Normal file
|
|
@ -0,0 +1 @@
|
|||
PLATFORM_NAME=mtt-dev-php74-nginx
|
||||
11
docker/dev/mtt-php74-nginx/Dockerfile-fpm
Normal file
11
docker/dev/mtt-php74-nginx/Dockerfile-fpm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
FROM php:7.4-fpm
|
||||
|
||||
RUN docker-php-ext-install mysqli && \
|
||||
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
|
||||
mkdir /var/www/phpinfo
|
||||
|
||||
#COPY php-mtt.ini /usr/local/etc/php/conf.d/
|
||||
#COPY php-opcache.ini /usr/local/etc/php/conf.d/
|
||||
COPY phpinfo.php /var/www/phpinfo/
|
||||
|
||||
VOLUME /var/www/html
|
||||
38
docker/dev/mtt-php74-nginx/compose.yml
Normal file
38
docker/dev/mtt-php74-nginx/compose.yml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
version: "3.9"
|
||||
|
||||
networks:
|
||||
network:
|
||||
name: "${PLATFORM_NAME}-network"
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: ../_nginx
|
||||
dockerfile: Dockerfile-nginx
|
||||
image: mytinytodo-dev:nginx
|
||||
container_name: ${PLATFORM_NAME}-web
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ../../../src:/var/www/html
|
||||
depends_on:
|
||||
- fpm
|
||||
networks:
|
||||
- network
|
||||
|
||||
fpm:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-fpm
|
||||
image: mytinytodo-dev:php7.4-fpm
|
||||
container_name: ${PLATFORM_NAME}-fpm
|
||||
hostname: php-fpm
|
||||
environment:
|
||||
- MTT_ENABLE_DEBUG=YES
|
||||
- MTT_DB_TYPE=sqlite
|
||||
volumes:
|
||||
- ../../../src:/var/www/html
|
||||
- ./php-mtt.ini:/usr/local/etc/php/conf.d/php-mtt.ini
|
||||
- ./php-opcache.ini:/usr/local/etc/php/conf.d/php-opcache.ini
|
||||
networks:
|
||||
- network
|
||||
9
docker/dev/mtt-php74-nginx/php-mtt.ini
Normal file
9
docker/dev/mtt-php74-nginx/php-mtt.ini
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
; Since PHP 5.4 E_STRICT is included in E_ALL
|
||||
error_reporting = E_ALL
|
||||
|
||||
log_errors = On
|
||||
display_errors = On
|
||||
display_startup_errors = On
|
||||
|
||||
cgi.fix_pathinfo=0
|
||||
42
docker/dev/mtt-php74-nginx/php-opcache.ini
Normal file
42
docker/dev/mtt-php74-nginx/php-opcache.ini
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
;; opcache.ini
|
||||
|
||||
;; check /usr/local/etc/php/conf.d if exists docker-php-ext-opcache.ini
|
||||
|
||||
; To disable opcache just comment this line
|
||||
zend_extension=opcache.so
|
||||
|
||||
[opcache]
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
|
||||
; JIT will work only if opcache is enabled and jit_buffer_size is not zero.
|
||||
; To disable JIT set the buffer size to 0.
|
||||
opcache.jit_buffer_size=64M
|
||||
|
||||
; JIT mode. Read more at https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit
|
||||
; Default is tracing.
|
||||
opcache.jit=tracing
|
||||
|
||||
; The size of the shared memory storage used by OPcache, in megabytes. The minimum permissible value is "8", which is enforced if a smaller value is set.
|
||||
; Default is 128.
|
||||
opcache.memory_consumption=128
|
||||
|
||||
; The maximum number of keys (and therefore scripts) in the OPcache hash table.
|
||||
; The actual value used will be the first number in the set of prime numbers
|
||||
; { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }
|
||||
; that is greater than or equal to the configured value.
|
||||
; The minimum value is 200. The maximum value is 1000000. Values outside of this range are clamped to the permissible range.
|
||||
; Default is 10000.
|
||||
opcache.max_accelerated_files=1000
|
||||
|
||||
; How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.
|
||||
; This configuration directive is ignored if opcache.validate_timestamps is disabled.
|
||||
; Default is 2.
|
||||
opcache.revalidate_freq=2
|
||||
|
||||
; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds.
|
||||
; When this directive is disabled, you must reset OPcache manually via opcache_reset(), opcache_invalidate()
|
||||
; or by restarting the Web server for changes to the filesystem to take effect.
|
||||
; Default is 1.
|
||||
;; Override in docker-compose
|
||||
opcache.validate_timestamps=1
|
||||
3
docker/dev/mtt-php74-nginx/phpinfo.php
Normal file
3
docker/dev/mtt-php74-nginx/phpinfo.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
phpinfo();
|
||||
1
docker/dev/mtt-php81-nginx/.env
Normal file
1
docker/dev/mtt-php81-nginx/.env
Normal file
|
|
@ -0,0 +1 @@
|
|||
PLATFORM_NAME=mtt-dev-php81-nginx
|
||||
11
docker/dev/mtt-php81-nginx/Dockerfile-fpm
Normal file
11
docker/dev/mtt-php81-nginx/Dockerfile-fpm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
FROM php:8.1-fpm
|
||||
|
||||
RUN docker-php-ext-install mysqli && \
|
||||
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
|
||||
mkdir /var/www/phpinfo
|
||||
|
||||
#COPY php-mtt.ini /usr/local/etc/php/conf.d/
|
||||
#COPY php-opcache.ini /usr/local/etc/php/conf.d/
|
||||
COPY phpinfo.php /var/www/phpinfo/
|
||||
|
||||
VOLUME /var/www/html
|
||||
38
docker/dev/mtt-php81-nginx/compose.yml
Normal file
38
docker/dev/mtt-php81-nginx/compose.yml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
version: "3.9"
|
||||
|
||||
networks:
|
||||
network:
|
||||
name: "${PLATFORM_NAME}-network"
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: ../_nginx
|
||||
dockerfile: Dockerfile-nginx
|
||||
image: mytinytodo-dev:nginx
|
||||
container_name: ${PLATFORM_NAME}-web
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ../../../src:/var/www/html
|
||||
depends_on:
|
||||
- fpm
|
||||
networks:
|
||||
- network
|
||||
|
||||
fpm:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-fpm
|
||||
image: mytinytodo-dev:php8.1-fpm
|
||||
container_name: ${PLATFORM_NAME}-fpm
|
||||
hostname: php-fpm
|
||||
environment:
|
||||
- MTT_ENABLE_DEBUG=YES
|
||||
- MTT_DB_TYPE=sqlite
|
||||
volumes:
|
||||
- ../../../src:/var/www/html
|
||||
- ./php-mtt.ini:/usr/local/etc/php/conf.d/php-mtt.ini
|
||||
- ./php-opcache.ini:/usr/local/etc/php/conf.d/php-opcache.ini
|
||||
networks:
|
||||
- network
|
||||
9
docker/dev/mtt-php81-nginx/php-mtt.ini
Normal file
9
docker/dev/mtt-php81-nginx/php-mtt.ini
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
; Since PHP 5.4 E_STRICT is included in E_ALL
|
||||
error_reporting = E_ALL
|
||||
|
||||
log_errors = On
|
||||
display_errors = On
|
||||
display_startup_errors = On
|
||||
|
||||
cgi.fix_pathinfo=0
|
||||
42
docker/dev/mtt-php81-nginx/php-opcache.ini
Normal file
42
docker/dev/mtt-php81-nginx/php-opcache.ini
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
;; opcache.ini
|
||||
|
||||
;; check /usr/local/etc/php/conf.d if exists docker-php-ext-opcache.ini
|
||||
|
||||
; To disable opcache just comment this line
|
||||
zend_extension=opcache.so
|
||||
|
||||
[opcache]
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
|
||||
; JIT will work only if opcache is enabled and jit_buffer_size is not zero.
|
||||
; To disable JIT set the buffer size to 0.
|
||||
opcache.jit_buffer_size=64M
|
||||
|
||||
; JIT mode. Read more at https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit
|
||||
; Default is tracing.
|
||||
opcache.jit=tracing
|
||||
|
||||
; The size of the shared memory storage used by OPcache, in megabytes. The minimum permissible value is "8", which is enforced if a smaller value is set.
|
||||
; Default is 128.
|
||||
opcache.memory_consumption=128
|
||||
|
||||
; The maximum number of keys (and therefore scripts) in the OPcache hash table.
|
||||
; The actual value used will be the first number in the set of prime numbers
|
||||
; { 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }
|
||||
; that is greater than or equal to the configured value.
|
||||
; The minimum value is 200. The maximum value is 1000000. Values outside of this range are clamped to the permissible range.
|
||||
; Default is 10000.
|
||||
opcache.max_accelerated_files=1000
|
||||
|
||||
; How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.
|
||||
; This configuration directive is ignored if opcache.validate_timestamps is disabled.
|
||||
; Default is 2.
|
||||
opcache.revalidate_freq=2
|
||||
|
||||
; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds.
|
||||
; When this directive is disabled, you must reset OPcache manually via opcache_reset(), opcache_invalidate()
|
||||
; or by restarting the Web server for changes to the filesystem to take effect.
|
||||
; Default is 1.
|
||||
;; Override in docker-compose
|
||||
opcache.validate_timestamps=1
|
||||
3
docker/dev/mtt-php81-nginx/phpinfo.php
Normal file
3
docker/dev/mtt-php81-nginx/phpinfo.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
phpinfo();
|
||||
Loading…
Reference in a new issue