Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Fix the remote client IP.
Browse files Browse the repository at this point in the history
Without this, it is impossible to use "Require ip" apache restriction.
And logging is not correct.
  • Loading branch information
dabelenda committed Dec 4, 2017
1 parent 1c1a113 commit 7c226a0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions build/httpd/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set -e
cat > /etc/apache2/conf-available/dyn-vhost.conf <<EOF
UseCanonicalName Off
SetEnvIf X-Forwarded-For "^(.*\..*\..*\..*)|(.*:.*:.*:.*:.*:.*:.*:.*)" proxied
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
LogFormat "%V %{X-Forwarded-For}i %l %u %t \"%r\" %s %b" vproxy
CustomLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/access_log.%Y%m%d 86400" vcommon env=!proxied
CustomLog "/dev/stdout" vcommon env=!proxied
CustomLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/access_log.%Y%m%d 86400" vproxy env=proxied
CustomLog "/dev/stdout" vproxy env=proxied
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 172.31.0.0/16 10.180.21.0/24
LogFormat "%V %a %l %u %t \"%r\" %s %b %{ms}T" vcommon
CustomLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/access_log.%Y%m%d 86400" vcommon
CustomLog "/dev/stdout" vcommon
ErrorLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/error_log.%Y%m%d 86400"
VirtualDocumentRoot "/srv/${WP_ENV}/%0/htdocs"
Expand All @@ -33,6 +33,7 @@ EOF
/usr/sbin/a2enmod ssl
/usr/sbin/a2enmod rewrite
/usr/sbin/a2enmod vhost_alias
/usr/sbin/a2enmod remoteip
/usr/sbin/a2enconf dyn-vhost

/usr/sbin/apache2ctl -DFOREGROUND

0 comments on commit 7c226a0

Please sign in to comment.