Skip to content

Commit fee52fd

Browse files
committed
Merge #369 - Allow a different Apache port with APACHE_PORT
Pull-request: #369 Fixes: #340 Ref: #187
2 parents 3c16423 + aa64816 commit fee52fd

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma
164164
* ``MEMORY_LIMIT`` - if set, will override the memory limit (default 512M) for phpMyAdmin ([$cfg['MemoryLimit']](https://docs.phpmyadmin.net/en/latest/config.html#cfg_MemoryLimit)) and PHP [memory_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) (format as `[0-9+](K,M,G)` where K is for Kilobytes, M for Megabytes, G for Gigabytes and 1K = 1024 bytes)
165165
* ``UPLOAD_LIMIT`` - if set, this option will override the default value for apache and php-fpm (format as `[0-9+](K,M,G)` default value is 2048K, this will change ``upload_max_filesize`` and ``post_max_size`` values)
166166
* ``HIDE_PHP_VERSION`` - if defined, this option will hide the PHP version (`expose_php = Off`). Set to any value (such as `HIDE_PHP_VERSION=true`).
167+
* ``APACHE_PORT`` - if defined, this option will change the default Apache port from `80` in case you want it to run on a different port like an unprivileged port. Set to any port value (such as `APACHE_PORT=8090`)
167168

168169
For usage with Docker secrets, appending ``_FILE`` to the ``PMA_PASSWORD`` environment variable is allowed (it overrides ``PMA_PASSWORD`` if it is set):
169170

apache/docker-entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
2828
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
2929
fi
3030

31+
if [ -n "${APACHE_PORT+x}" ]; then
32+
echo "Setting apache port to ${APACHE_PORT}."
33+
sed -i "s/VirtualHost \*:80/VirtualHost \*:${APACHE_PORT}/" /etc/apache2/sites-enabled/000-default.conf
34+
sed -i "s/Listen 80/Listen ${APACHE_PORT}/" /etc/apache2/ports.conf
35+
apachectl configtest
36+
fi
37+
3138
get_docker_secret() {
3239
local env_var="${1}"
3340
local env_var_file="${env_var}_FILE"

docker-entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ if [ ! -z "${PMA_USER_CONFIG_BASE64}" ]; then
2828
echo "${PMA_USER_CONFIG_BASE64}" | base64 -d > /etc/phpmyadmin/config.user.inc.php
2929
fi
3030

31+
if [ -n "${APACHE_PORT+x}" ]; then
32+
echo "Setting apache port to ${APACHE_PORT}."
33+
sed -i "s/VirtualHost \*:80/VirtualHost \*:${APACHE_PORT}/" /etc/apache2/sites-enabled/000-default.conf
34+
sed -i "s/Listen 80/Listen ${APACHE_PORT}/" /etc/apache2/ports.conf
35+
apachectl configtest
36+
fi
37+
3138
get_docker_secret() {
3239
local env_var="${1}"
3340
local env_var_file="${env_var}_FILE"

0 commit comments

Comments
 (0)