Skip to content

Commit

Permalink
Enable remoteip mod for Apache
Browse files Browse the repository at this point in the history
  • Loading branch information
daohoangson committed Jan 9, 2020
1 parent aa01ff6 commit b9387ab
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
4 changes: 3 additions & 1 deletion php-apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ ENV COMPOSER_VERSION 1.9.1
# https://github.com/wimg/PHPCompatibility/releases
ENV PHP_COMPATIBILITY_VERSION 9.3.4

COPY . /tmp/.
COPY tmp /tmp
RUN /tmp/build.sh

COPY apache2 /etc/apache2
2 changes: 1 addition & 1 deletion php-apache/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.12
7.3.12c
11 changes: 11 additions & 0 deletions php-apache/apache2/conf-available/xfrocks.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

RemoteIPHeader X-Forwarded-For
# https://tools.ietf.org/html/rfc1918#section-3
RemoteIPTrustedProxy 10.0.0.0/8
RemoteIPTrustedProxy 172.16.0.0/12
RemoteIPTrustedProxy 192.168.0.0/16
3 changes: 3 additions & 0 deletions php-apache/apache2/sites-available/000-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<VirtualHost *:80>
Include conf-available/xfrocks.conf
</VirtualHost>
7 changes: 7 additions & 0 deletions php-apache/apache2/sites-available/default-ssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<VirtualHost _default_:443>
Include conf-available/xfrocks.conf

SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ curl -Lo /tmp/PHPCompatibility.tar.gz "https://github.com/wimg/PHPCompatibility/
tar -xzf /tmp/PHPCompatibility.tar.gz -C /usr/local/share/
phpcs --config-set installed_paths "/usr/local/share/PHPCompatibility-${PHP_COMPATIBILITY_VERSION}"

# remote ip (`X-Forwarded-For` header etc.)
a2enmod remoteip

# tls
openssl req \
-days 365 \
-keyout /etc/ssl/private/ssl-cert-snakeoil.key \
-newkey rsa:4096 \
-nodes \
-out /etc/ssl/certs/ssl-cert-snakeoil.pem \
-subj "/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=php-apache.docker" \
-subj "/C=VN/ST=Hanoi/O=xfrocks/CN=php-apache" \
-x509
a2enmod ssl
a2ensite default-ssl

0 comments on commit b9387ab

Please sign in to comment.