Skip to content

Commit 3e05ece

Browse files
authored
Merge pull request #102 from bryanlatten/local-status
FPM/Nginx: allowing locally-accessed fpm status
2 parents 6d5d84f + d1cad40 commit 3e05ece

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ RUN phpenmod overrides && \
122122
sed -i "s/listen [0-9]*;/listen ${CONTAINER_PORT};/" $CONF_NGINX_SITE && \
123123
# Enable NewRelic via Ubuntu symlinks, but disable via extension command in file. Allows cross-variant startup scripts to function.
124124
phpenmod newrelic && \
125-
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/newrelic.ini
125+
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/newrelic.ini && \
126+
# Enable status page at "/__status"
127+
sed -i 's/;pm.status_path = .*/pm.status_path = \/__status/' $CONF_FPMPOOL
126128

127129
RUN goss -g /tests/php-fpm/ubuntu.goss.yaml validate && \
128130
/aufs_hack.sh

Dockerfile-alpine

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ COPY ./container/root /
142142

143143
# Make additional hacks to migrate files from Ubuntu to Alpine folder structure
144144
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
145-
rm $CONF_PHPMODS/00_opcache.ini
145+
rm $CONF_PHPMODS/00_opcache.ini && \
146+
# Enable status page at "/__status"
147+
sed -i 's/;pm.status_path = .*/pm.status_path = \/__status/' $CONF_FPMPOOL
146148

147149
RUN goss -g /tests/php-fpm/alpine.goss.yaml validate && \
148150
/aufs_hack.sh

Dockerfile-edge

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
130130
sed -i "s/listen [0-9]*;/listen ${CONTAINER_PORT};/" $CONF_NGINX_SITE && \
131131
# Enable NewRelic via Ubuntu symlinks, but disable in file. Cross-variant startup script uncomments with env vars.
132132
phpenmod newrelic && \
133-
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/newrelic.ini
133+
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/newrelic.ini && \
134+
# Enable status page at "/__status"
135+
sed -i 's/;pm.status_path = .*/pm.status_path = \/__status/' $CONF_FPMPOOL
134136

135137
RUN goss -g /tests/php-fpm/beta.goss.yaml validate && \
136138
/aufs_hack.sh

container/root/etc/nginx/sites-available/default

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ server {
4444
fastcgi_pass 127.0.0.1:9000;
4545
}
4646

47+
# Allow locally-accessible (only) FPM status page
48+
location ~ ^/__status$ {
49+
access_log off;
50+
allow 127.0.0.1;
51+
deny all;
52+
include fastcgi_params;
53+
fastcgi_pass 127.0.0.1:9000;
54+
}
55+
4756
# Protect against accessing hidden files
4857
location ~ /\. {
4958
access_log off;

0 commit comments

Comments
 (0)