Files
my-projects-website/app/docker/web/start.sh
T
kor-elf b35f04d220 Replace Unit configuration with Nginx + PHP-FPM setup in Docker
- Remove outdated Unit-based Docker configuration and scripts.
- Introduce Nginx + PHP-FPM stack with environment-based configurations.
- Add custom Nginx setup for frontend-backend routing.
- Update Dockerfiles, Docker Compose, and related scripts for new architecture.
2026-07-15 00:12:32 +05:00

36 lines
1.0 KiB
Bash

#!/usr/bin/env sh
if [ "$IS_GZIP" = "1" ]; then
GZIP_BLOCK='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;
gzip_min_length 1024;'
else
GZIP_BLOCK=''
fi
export GZIP_BLOCK
if [ -n "$TRUSTED_PROXY_CIDR" ]; then
REAL_IP_BLOCK="set_real_ip_from $TRUSTED_PROXY_CIDR;
real_ip_header X-Forwarded-For;
real_ip_recursive on;"
else
REAL_IP_BLOCK=""
fi
export REAL_IP_BLOCK
export BACKEND_HOST="${BACKEND_HOST:-app}"
export BACKEND_PORT="${BACKEND_PORT:-9000}"
export FRONTEND_PORT="${FRONTEND_PORT:-''}"
export NGINX_CLIENT_MAX_BODY_SIZE="${NGINX_CLIENT_MAX_BODY_SIZE:-'20m'}"
envsubst '$BACKEND_HOST $BACKEND_PORT $GZIP_BLOCK $REAL_IP_BLOCK $FRONTEND_PORT $NGINX_CLIENT_MAX_BODY_SIZE' \
< /etc/nginx/templates/default.conf.template \
> /etc/nginx/conf.d/default.conf
exec nginx -g 'daemon off;'