Add PHP
This commit is contained in:
13
PHP/Dockerfile
Normal file
13
PHP/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM php:8.2-fpm
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y zip curl libcurl3-dev libzip-dev libpng-dev libonig-dev libxml2-dev
|
||||
|
||||
RUN docker-php-ext-install curl gd mbstring mysqli pdo pdo_mysql xml
|
||||
|
||||
RUN apt-get install -y libmagickwand-dev
|
||||
RUN pecl install imagick
|
||||
RUN docker-php-ext-enable imagick
|
||||
RUN apt-get purge -y libmagickwand-dev
|
||||
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
22
PHP/docker-compose.yml
Normal file
22
PHP/docker-compose.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
services:
|
||||
php:
|
||||
container_name: php
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
volumes:
|
||||
- './www:/var/www/html'
|
||||
- './php-logging.conf:/usr/local/etc/php-fpm.d/zz-log.conf'
|
||||
|
||||
nginx:
|
||||
container_name: nginx
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- '80:80'
|
||||
links:
|
||||
- 'php'
|
||||
volumes:
|
||||
- './www:/var/www/html'
|
||||
- './nginx.conf:/etc/nginx/conf.d/nginx.conf'
|
||||
depends_on:
|
||||
- php
|
||||
29
PHP/nginx.conf
Normal file
29
PHP/nginx.conf
Normal file
@@ -0,0 +1,29 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
|
||||
server_name localhost;
|
||||
|
||||
root /var/www/html;
|
||||
index index.php index.html;
|
||||
|
||||
# Support Yii2 pretty URL routing
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/(.*) /index.php?r=$1 last;
|
||||
}
|
||||
}
|
||||
|
||||
location ~* \.php$ {
|
||||
fastcgi_pass php:9000;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
}
|
||||
|
||||
# Prevent additional headers like TRACE, DELETE, PUSH
|
||||
if ($request_method !~ ^(GET|HEAD|POST)$ )
|
||||
{
|
||||
return 405;
|
||||
}
|
||||
}
|
||||
2
PHP/php-logging.conf
Normal file
2
PHP/php-logging.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
php_admin_flag[log_errors] = on
|
||||
php_flag[display_errors] = off
|
||||
Reference in New Issue
Block a user