Skip to content

Commit

Permalink
Fixed Nginx images running under root
Browse files Browse the repository at this point in the history
  • Loading branch information
dotneft committed Jul 5, 2024
1 parent 48a86df commit cd72f8e
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-mysql/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-mysql/centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/web-nginx-mysql/ol/conf/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-mysql/ol/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/web-nginx-mysql/rhel/conf/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-mysql/rhel/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user www-data;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-mysql/ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="www-data"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-pgsql/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-pgsql/centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/web-nginx-pgsql/ol/conf/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-pgsql/ol/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/web-nginx-pgsql/rhel/conf/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user nginx;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-pgsql/rhel/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="nginx"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#user nginx;
# user www-data;
worker_processes 5;
worker_rlimit_nofile 256000;

Expand Down
13 changes: 9 additions & 4 deletions Dockerfiles/web-nginx-pgsql/ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
# Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"}

# Default user
: ${DAEMON_USER:="www-data"}

# Default directories
# Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix"
Expand Down Expand Up @@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}

if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"

echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.owner = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
fi

: ${ZBX_DENY_GUI_ACCESS:="false"}
Expand Down

0 comments on commit cd72f8e

Please sign in to comment.