Skip to content

Commit e16220a

Browse files
committed
feat: add Nginx and Supervisor configuration files with custom PHP settings
1 parent 55bf11b commit e16220a

6 files changed

Lines changed: 74 additions & 0 deletions

File tree

php/8.3/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,13 @@ RUN yes | pecl install xdebug && \
6060

6161
WORKDIR /home/wwwroot
6262

63+
COPY nginx-site.conf.template /etc/nginx/conf.d/default.conf.template
64+
COPY custom_php.ini /usr/local/etc/php/conf.d/custom_php.ini
65+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
66+
COPY vite.conf.template /etc/supervisor/conf.d/vite.conf.template
67+
68+
COPY entrypoint.sh /entrypoint.sh
69+
RUN chmod +x /entrypoint.sh
70+
71+
ENTRYPOINT ["/entrypoint.sh"]
6372
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

php/8.3/custom_php.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
memory_limit = 3000M ;default: 128M
2+
post_max_size = 1024M ;default:8M
3+
upload_max_filesize = 1024M ;default:2M
4+
log_errors = On
5+
display_errors = On
6+
error_log = /dev/stderr
7+
max_execution_time = 99999

php/8.3/entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
set -e
3+
4+
envsubst '$NGINX_ROOT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
5+
6+
if [ "${VITE_ENABLED}" = "true" ]; then
7+
envsubst '$PROJECT_ROOT' < /etc/supervisor/conf.d/vite.conf.template >> /etc/supervisor/conf.d/supervisord.conf
8+
fi
9+
10+
exec "$@"

php/8.3/nginx-site.conf.template

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
server {
2+
listen 80 default_server;
3+
listen [::]:80;
4+
server_name php.local;
5+
root ${NGINX_ROOT};
6+
client_max_body_size 100m;
7+
8+
index index.php;
9+
charset utf-8;
10+
11+
error_log /home/wwwlogs/nginx-error-log.log;
12+
access_log /home/wwwlogs/nginx-access.log;
13+
14+
location / {
15+
try_files $uri $uri/ /index.php?$query_string;
16+
}
17+
18+
location ~ \.php$ {
19+
include fastcgi_params;
20+
fastcgi_pass 127.0.0.1:9000;
21+
fastcgi_index index.php;
22+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
23+
}
24+
}

php/8.3/supervisord.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[supervisord]
2+
logfile=/var/log/supervisor/supervisord.log
3+
pidfile=/run/supervisord.pid
4+
nodaemon=true
5+
6+
[program:php-fpm]
7+
command=php-fpm
8+
9+
[program:nginx]
10+
command=nginx -g "daemon off;"
11+
12+
[program:cron]
13+
command=cron -f
14+
autostart=true

php/8.3/vite.conf.template

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[program:vite]
2+
command=npm run dev
3+
directory=${PROJECT_ROOT}
4+
autorestart=true
5+
stdout_logfile=/home/wwwlogs/vite-stdout.log
6+
stderr_logfile=/home/wwwlogs/vite-stderr.log
7+
stdout_logfile_maxbytes=10MB
8+
stderr_logfile_maxbytes=10MB
9+
stdout_logfile_backups=5
10+
stderr_logfile_backups=5

0 commit comments

Comments
 (0)