Skip to content

Commit ee9039b

Browse files
authored
[php] Fix Nginx Unit (#9037)
* Fix Nginx Unit with PHP * Clean FrankenPHP Dockerfile * Clean Unit Dockerfile
1 parent 843bc57 commit ee9039b

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

frameworks/PHP/php/deploy/nginx-unit.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
"applications": {
99
"benchmark": {
1010
"type": "php",
11-
"processes": 84,
11+
"processes": {
12+
"max": 224,
13+
"spare": 168,
14+
"idle_timeout": 20
15+
},
1216
"user": "www-data",
1317
"group": "www-data",
1418
"root": "/php/",
@@ -19,5 +23,10 @@
1923
"requests": 10000000
2024
}
2125
}
26+
},
27+
"settings": {
28+
"http": {
29+
"server_version": false
30+
}
2231
}
2332
}

frameworks/PHP/php/php-franken.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ FROM dunglas/frankenphp
44
RUN install-php-extensions \
55
pdo_mysql \
66
zip \
7-
opcache
7+
opcache > /dev/null
88

99

10-
COPY deploy/franken/Caddyfile /etc/caddy/Caddyfile
10+
COPY --link deploy/franken/Caddyfile /etc/caddy/Caddyfile
11+
COPY --link deploy/conf/php.ini /usr/local/etc/php/
1112

12-
ADD . /php
13+
COPY --link . /php
1314

1415
# Worker mode
1516
#ENV FRANKENPHP_CONFIG="worker ./public/index.php"
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
FROM unit:php8.3
22

3-
ADD . /php
3+
RUN docker-php-ext-install pdo_mysql opcache > /dev/null
4+
45
WORKDIR /php
6+
COPY --link . .
57

6-
RUN docker-php-ext-install pdo_mysql opcache > /dev/null
7-
RUN if [ $(nproc) = 2 ]; then sed -i "s|\"processes\": 84,|\"processes\": 64,|g" /php/deploy/nginx-unit.json ; fi;
8+
RUN if [ $(nproc) = 2 ]; then sed -i "s|\"spare\": 168,|\"spare\": 64,|g" /php/deploy/nginx-unit.json ; fi;
89

9-
EXPOSE 8080
10+
#RUN more /php/deploy/nginx-unit.json
1011

11-
COPY deploy/nginx-unit.json /docker-entrypoint.d/nginx-unit.json
12+
RUN unitd && \
13+
curl -X PUT --data-binary @/php/deploy/nginx-unit.json --unix-socket \
14+
/var/run/control.unit.sock http://localhost/config
15+
16+
ENTRYPOINT [ ]
17+
18+
EXPOSE 8080
1219

1320
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]

0 commit comments

Comments
 (0)