caddy for php

This commit is contained in:
rainerosion 2023-02-06 16:47:26 +08:00
parent 9219b52b92
commit 95b99a935b
5 changed files with 104 additions and 0 deletions

6
typecho/Caddyfile Normal file
View File

@ -0,0 +1,6 @@
rlds.tk {
encode gzip
root * /www/websites/typecho
php_fastcgi php-fpm:9000
file_server
}

54
typecho/Dockerfile Normal file
View File

@ -0,0 +1,54 @@
FROM php:8.1.15-fpm-alpine3.17
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY Caddyfile /etc/caddy/Caddyfile
ENV BUILD_DEPS \
libzip-dev \
icu-dev \
postgresql-dev \
libpng-dev \
libwebp-dev \
libjpeg-turbo-dev \
curl-dev \
sqlite-dev \
oniguruma-dev \
memcached-dev
ENV RUN_DEPS \
autoconf \
libzip \
icu \
postgresql-libs \
libpng \
libwebp \
libjpeg-turbo \
curl \
sqlite-libs \
oniguruma \
memcached
ENV PHP_EXTENSIONS \
zip \
intl \
exif \
pdo_mysql \
pdo_pgsql \
mysqli \
pgsql \
gd \
curl \
session \
pdo_sqlite \
fileinfo \
mbstring
RUN set -eux && \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add --no-cache $RUN_DEPS && \
apk add --no-cache --virtual .build-deps $BUILD_DEPS && \
docker-php-ext-configure gd --enable-gd --with-jpeg --with-webp && \
docker-php-ext-install -j $(nproc) $PHP_EXTENSIONS && \
# pecl install redis memcached && \
# docker-php-ext-enable redis memcached && \
apk del .build-deps

16
typecho/caddy/Caddyfile Normal file
View File

@ -0,0 +1,16 @@
{
auto_https disable_redirects
email admin@rainss.cc
}
rainss.net:80 {
encode gzip
root * /www/websites/typecho
php_fastcgi php-fpm:9000
file_server
}
http://pay.test {
root * /www/websites/typecho
encode gzip
php_fastcgi php-fpm:9000
file_server
}

View File

@ -0,0 +1,28 @@
version: '3.2'
services:
webservice:
container_name: caddy
image: caddy:latest
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
- ./caddy/config:/config
- ./caddy/data:/data
- ./caddy/websites:/www/websites
depends_on:
- php-cgi
restart: unless-stopped
php-cgi:
container_name: php-fpm
build:
context: .
dockerfile: Dockerfile
volumes:
- ./caddy/websites:/www/websites
# - ./caddy/config/php:/usr/local/etc/php
restart: unless-stopped
networks:
website: