Many improvements to the server #4
12
Dockerfile
12
Dockerfile
@ -1,10 +1,12 @@
|
|||||||
FROM alpine:3.14
|
FROM ubuntu:23.04
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apk update && \
|
RUN apt update
|
||||||
apk upgrade && \
|
RUN DEBIAN_FRONTEND=noninteractive \
|
||||||
apk add --no-cache nginx php8.1 php8.1-fpm php8.1-gd php8.1-imagick && \
|
apt install nginx php8.1 php8.1-fpm php8.1-gd php8.1-imagick -y
|
||||||
rm -rf /var/cache/apk/*
|
|
||||||
|
# Clean up
|
||||||
|
RUN apt clean
|
||||||
|
|
||||||
# Set up nginx
|
# Set up nginx
|
||||||
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
|
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#!/bin/sh
|
if [[ -z "${MAX_UPLOAD_SIZE}" ]]; then
|
||||||
|
|
||||||
if [ -z "$MAX_UPLOAD_SIZE" ]; then
|
|
||||||
MAX_UPLOAD_SIZE="8M" # Default fallback value
|
MAX_UPLOAD_SIZE="8M" # Default fallback value
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -13,8 +11,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Letting php know that we are running in docker
|
# Letting php know that we are running in docker
|
||||||
echo "env[DOCKER] = true" >> /etc/php8/php-fpm.d/www.conf
|
echo "env[DOCKER] = true" >> /etc/php/8.1/fpm/pool.d/www.conf
|
||||||
echo "clear_env = no" >> /etc/php8/php-fpm.d/www.conf
|
echo "clear_env = no" >> /etc/php/8.1/fpm/pool.d/www.conf
|
||||||
|
|
||||||
echo "Setting permissions for upload script"
|
echo "Setting permissions for upload script"
|
||||||
chmod 777 /var/www/html/upload.php
|
chmod 777 /var/www/html/upload.php
|
||||||
@ -22,15 +20,16 @@ chmod 777 /var/www/html/upload.php
|
|||||||
echo "Setting max upload size to ${MAX_UPLOAD_SIZE}"
|
echo "Setting max upload size to ${MAX_UPLOAD_SIZE}"
|
||||||
|
|
||||||
# Set max upload size for php
|
# Set max upload size for php
|
||||||
sed -i "s/^upload_max_filesize = .*/upload_max_filesize = ${MAX_UPLOAD_SIZE}/" /etc/php8/php.ini
|
sed -i "s/^upload_max_filesize = .*/upload_max_filesize = ${MAX_UPLOAD_SIZE}/" /etc/php/8.1/fpm/php.ini
|
||||||
sed -i "s/^post_max_size = .*/post_max_size = ${MAX_UPLOAD_SIZE}/" /etc/php8/php.ini
|
sed -i "s/^post_max_size = .*/post_max_size = ${MAX_UPLOAD_SIZE}/" /etc/php/8.1/fpm/php.ini
|
||||||
|
|
||||||
# Set max upload size for nginx
|
# Set max upload size for nginx
|
||||||
sed -i "s/client_max_body_size 500M;/client_max_body_size ${MAX_UPLOAD_SIZE};/" /etc/nginx/nginx.conf
|
sed -i "s/client_max_body_size 500M;/client_max_body_size ${MAX_UPLOAD_SIZE};/" /etc/nginx/nginx.conf
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
echo "Starting PHP & Nginx"
|
echo "Starting PHP & Nginx"
|
||||||
php-fpm8 &&
|
/etc/init.d/php8.1-fpm start &&
|
||||||
|
chmod 777 /run/php/php8.1-fpm.sock &&
|
||||||
nginx -g 'daemon off;'
|
nginx -g 'daemon off;'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user