Allow to run Nginx based images under root user

This commit is contained in:
Alexey Pustovalov 2020-05-28 17:16:06 +03:00
parent 4b0b504bbc
commit 3aa23d47a2
6 changed files with 42 additions and 0 deletions

View File

@ -236,6 +236,13 @@ prepare_zbx_web_config() {
update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}"
update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}"
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"
fi
# Escaping characters in parameter value # Escaping characters in parameter value
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}") server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}") server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")

View File

@ -236,6 +236,13 @@ prepare_zbx_web_config() {
update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}"
update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}"
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"
fi
# Escaping characters in parameter value # Escaping characters in parameter value
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}") server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}") server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")

View File

@ -236,6 +236,13 @@ prepare_zbx_web_config() {
update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}"
update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}"
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"
fi
# Escaping characters in parameter value # Escaping characters in parameter value
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}") server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}") server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")

View File

@ -236,6 +236,13 @@ prepare_zbx_web_config() {
update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}"
update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}"
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"
fi
# Escaping characters in parameter value # Escaping characters in parameter value
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}") server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}") server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")

View File

@ -236,6 +236,13 @@ prepare_zbx_web_config() {
update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}"
update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}"
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"
fi
# Escaping characters in parameter value # Escaping characters in parameter value
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}") server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}") server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")

View File

@ -236,6 +236,13 @@ prepare_zbx_web_config() {
update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}" update_config_var "$PHP_CONFIG_FILE" "php_value[max_input_time]" "${ZBX_MAXINPUTTIME:-"300"}"
update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}" update_config_var "$PHP_CONFIG_FILE" "php_value[date.timezone]" "${PHP_TZ}"
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"
fi
# Escaping characters in parameter value # Escaping characters in parameter value
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}") server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}") server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")