Fixed Nginx images running under root

This commit is contained in:
Alexey Pustovalov 2024-07-05 13:21:12 +09:00
parent 6205742aea
commit e018c30303
18 changed files with 90 additions and 45 deletions

View File

@ -1,4 +1,4 @@
#user nginx; # user nginx;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="nginx"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user nginx;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="nginx"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user nginx;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="nginx"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user nginx;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="nginx"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user www-data;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="www-data"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -173,10 +176,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user nginx;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="nginx"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user nginx;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="nginx"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user nginx;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="nginx"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}

View File

@ -1,4 +1,4 @@
#user nginx; # user www-data;
worker_processes 5; worker_processes 5;
worker_rlimit_nofile 256000; worker_rlimit_nofile 256000;

View File

@ -18,6 +18,9 @@ fi
# Default timezone for web interface # Default timezone for web interface
: ${PHP_TZ:="Europe/Riga"} : ${PHP_TZ:="Europe/Riga"}
# Default user
: ${DAEMON_USER:="www-data"}
# Default directories # Default directories
# Configuration files directory # Configuration files directory
ZABBIX_ETC_DIR="/etc/zabbix" ZABBIX_ETC_DIR="/etc/zabbix"
@ -160,10 +163,12 @@ prepare_zbx_web_config() {
export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"} export PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-"0"}
if [ "$(id -u)" == '0' ]; then if [ "$(id -u)" == '0' ]; then
echo "user = zabbix" >> "$PHP_CONFIG_FILE" sed -i -e "/^[#;] user/s/.*/&\nuser ${DAEMON_USER};/" "$NGINX_CONF_FILE"
echo "group = zabbix" >> "$PHP_CONFIG_FILE"
echo "listen.owner = nginx" >> "$PHP_CONFIG_FILE" echo "user = ${DAEMON_USER}" >> "$PHP_CONFIG_FILE"
echo "listen.group = nginx" >> "$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 fi
: ${ZBX_DENY_GUI_ACCESS:="false"} : ${ZBX_DENY_GUI_ACCESS:="false"}