Skip to content

Commit

Permalink
Fix display of remote ip in php log
Browse files Browse the repository at this point in the history
  • Loading branch information
ne20002 committed Feb 21, 2025
1 parent 0e7b3d2 commit f4ff69c
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion 2024.08/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ RUN set -ex; \
RUN set -ex; \
a2enmod rewrite remoteip; \
{ \
echo RemoteIPHeader X-Real-IP; \
echo RemoteIPHeader X-Forwarded-For; \
echo RemoteIPTrustedProxy 127.0.0.0/8; \
echo RemoteIPTrustedProxy 10.0.0.0/8; \
echo RemoteIPTrustedProxy 172.16.0.0/12; \
echo RemoteIPTrustedProxy 192.168.0.0/16; \
Expand Down
3 changes: 2 additions & 1 deletion 2024.08/fpm-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ RUN set -ex; \
chown -R www-data:root /var/www; \
chmod -R g=u /var/www


RUN set -ex; \
echo access.format = '%{HTTP_X_FORWARDED_FOR}e - %u %t "%m %r" %s' >> /usr/local/etc/php-fpm.d/docker.conf;

VOLUME /var/www/html

Expand Down
3 changes: 2 additions & 1 deletion 2024.08/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ RUN set -ex; \
chown -R www-data:root /var/www; \
chmod -R g=u /var/www


RUN set -ex; \
echo access.format = '%{HTTP_X_FORWARDED_FOR}e - %u %t "%m %r" %s' >> /usr/local/etc/php-fpm.d/docker.conf;

VOLUME /var/www/html

Expand Down
3 changes: 2 additions & 1 deletion 2024.12/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ RUN set -ex; \
RUN set -ex; \
a2enmod rewrite remoteip; \
{ \
echo RemoteIPHeader X-Real-IP; \
echo RemoteIPHeader X-Forwarded-For; \
echo RemoteIPTrustedProxy 127.0.0.0/8; \
echo RemoteIPTrustedProxy 10.0.0.0/8; \
echo RemoteIPTrustedProxy 172.16.0.0/12; \
echo RemoteIPTrustedProxy 192.168.0.0/16; \
Expand Down
3 changes: 2 additions & 1 deletion 2024.12/fpm-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ RUN set -ex; \
chown -R www-data:root /var/www; \
chmod -R g=u /var/www


RUN set -ex; \
echo access.format = '%{HTTP_X_FORWARDED_FOR}e - %u %t "%m %r" %s' >> /usr/local/etc/php-fpm.d/docker.conf;

VOLUME /var/www/html

Expand Down
3 changes: 2 additions & 1 deletion 2024.12/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ RUN set -ex; \
chown -R www-data:root /var/www; \
chmod -R g=u /var/www


RUN set -ex; \
echo access.format = '%{HTTP_X_FORWARDED_FOR}e - %u %t "%m %r" %s' >> /usr/local/etc/php-fpm.d/docker.conf;

VOLUME /var/www/html

Expand Down
3 changes: 2 additions & 1 deletion 2025.02-dev/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ RUN set -ex; \
RUN set -ex; \
a2enmod rewrite remoteip; \
{ \
echo RemoteIPHeader X-Real-IP; \
echo RemoteIPHeader X-Forwarded-For; \
echo RemoteIPTrustedProxy 127.0.0.0/8; \
echo RemoteIPTrustedProxy 10.0.0.0/8; \
echo RemoteIPTrustedProxy 172.16.0.0/12; \
echo RemoteIPTrustedProxy 192.168.0.0/16; \
Expand Down
3 changes: 2 additions & 1 deletion 2025.02-dev/fpm-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ RUN set -ex; \
chown -R www-data:root /var/www; \
chmod -R g=u /var/www


RUN set -ex; \
echo access.format = '%{HTTP_X_FORWARDED_FOR}e - %u %t "%m %r" %s' >> /usr/local/etc/php-fpm.d/docker.conf;

VOLUME /var/www/html

Expand Down
3 changes: 2 additions & 1 deletion 2025.02-dev/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ RUN set -ex; \
chown -R www-data:root /var/www; \
chmod -R g=u /var/www


RUN set -ex; \
echo access.format = '%{HTTP_X_FORWARDED_FOR}e - %u %t "%m %r" %s' >> /usr/local/etc/php-fpm.d/docker.conf;

VOLUME /var/www/html

Expand Down
9 changes: 6 additions & 3 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ declare -A extras=(
[apache]='RUN set -ex; \
a2enmod rewrite remoteip; \
{ \
echo RemoteIPHeader X-Real-IP; \
echo RemoteIPHeader X-Forwarded-For; \
echo RemoteIPTrustedProxy 127.0.0.0/8; \
echo RemoteIPTrustedProxy 10.0.0.0/8; \
echo RemoteIPTrustedProxy 172.16.0.0/12; \
echo RemoteIPTrustedProxy 192.168.0.0/16; \
} > /etc/apache2/conf-available/remoteip.conf; \
a2enconf remoteip;'
[fpm]=''
[fpm-alpine]=''
[fpm]='RUN set -ex; \
echo access.format = '\''%{HTTP_X_FORWARDED_FOR}e - %u %t \"%m %r\" %s'\'' >> /usr/local/etc/php-fpm.d/docker.conf;'
[fpm-alpine]='RUN set -ex; \
echo access.format = '\''%{HTTP_X_FORWARDED_FOR}e - %u %t \"%m %r\" %s'\'' >> /usr/local/etc/php-fpm.d/docker.conf;'
)

declare -A entrypoints=(
Expand Down

0 comments on commit f4ff69c

Please sign in to comment.