0
0

Initial commit

This commit is contained in:
Anthony Axenov 2022-08-28 10:48:09 +08:00
commit b4ac2dc4de
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
11 changed files with 167 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.idea
.vscode
*.log
!/**/.gitkeep

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2022 Anthony Axenov (aka Антон Аксенов) <anthonyaxenov@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

15
README.md Normal file
View File

@ -0,0 +1,15 @@
# Dockerized minimal php-fpm + nginx app
Pretty simple starting point to make some prototype or small pet-project.
1. Drop or create your project in `./app` directory
2. Take a closer look on `docker-compose.yml` and [config](./docker) files, so feel free to use this environment as you want.
3. Run containers:
```
$ docker compose up --build
```
4. Go to [http://localhost:8080](http://localhost:8080)
To use xdebug you should listen to port 9003 in your IDE.
[WTFPLv2](LICENSE)

2
app/index.php Normal file
View File

@ -0,0 +1,2 @@
<?php
phpinfo();

41
docker-compose.yml Normal file
View File

@ -0,0 +1,41 @@
version: '3'
networks:
iptv:
driver: bridge
services:
php:
container_name: iptv-php
build: 'docker/php'
restart: unless-stopped
networks:
- iptv
volumes:
- /etc/localtime:/etc/localtime:ro
- ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
- ./docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
- ./log/php:/var/log/php:rw
- ./app:/var/www:rw
# - ./docker/php/xdebug:/var/xdebug:rw
# ports:
# - "9090:9000"
nginx:
container_name: iptv-nginx
image: nginx:latest
restart: unless-stopped
networks:
- iptv
volumes:
- /etc/localtime:/etc/localtime:ro
- ./docker/nginx/vhost.conf:/etc/nginx/conf.d/default.conf:ro
- ./log/nginx:/var/log/nginx:rw
- ./app:/var/www:ro
ports:
- 8080:80
links:
- php
depends_on:
- php

30
docker/nginx/vhost.conf Normal file
View File

@ -0,0 +1,30 @@
server {
server_name myproj.local;
listen 80;
root /var/www;
index index.php;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}

13
docker/php/dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM php:8.1-fpm
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN pecl channel-update pecl.php.net && \
# версию пакета oci8 для установки можно проверять здесь https://pecl.php.net/package/xdebug
pecl install xdebug-3.1.5
RUN mkdir -p /var/log/php
WORKDIR /var/www
EXPOSE 9000
CMD ["php-fpm"]

28
docker/php/php.ini Normal file
View File

@ -0,0 +1,28 @@
[PHP]
file_uploads=Off
; upload_max_filesize=256M
; post_max_size=256M
error_reporting=E_ALL
;& ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.max_accelerated_files=30000
opcache.revalidate_freq=0
; opcache.jit_buffer_size=64M
; opcache.jit=tracing
[xdebug]
; https://xdebug.org/docs/all_settings
zend_extension=xdebug.so
xdebug.mode=develop,debug
xdebug.REQUEST=*
xdebug.SESSION=*
xdebug.SERVER=*
xdebug.client_host=172.17.0.1
xdebug.start_with_request=yes
; xdebug.profiler_output_name=cachegrind.out.%r
; xdebug.trace_output_name=trace.%r
; xdebug.output_dir=/var/xdebug

21
docker/php/www.conf Normal file
View File

@ -0,0 +1,21 @@
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 50
pm.status_path = /status
ping.path = /ping
ping.response = pong
access.log = /var/log/php/$pool.access.log
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%"
; chroot = /var/www
; chdir = /var/www
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/php/www.error.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 32M

0
log/nginx/.gitkeep Normal file
View File

0
log/php/.gitkeep Normal file
View File