mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-08-14 10:48:35 +02:00
Migrate to PHP-FPM for all Web images
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
<IfModule mime_module>
|
||||
TypesConfig /etc/apache2/mime.types
|
||||
AddType application/x-compress .Z
|
||||
AddType application/x-gzip .gz .tgz
|
||||
</IfModule>
|
||||
<IfModule mime_magic_module>
|
||||
MIMEMagicFile /etc/apache2/magic
|
||||
</IfModule>
|
@ -0,0 +1,75 @@
|
||||
ServerRoot /etc/apache2/
|
||||
ServerRoot /var/www
|
||||
DefaultRuntimeDir /tmp/apache2/
|
||||
PidFile /tmp/apache2.pid
|
||||
|
||||
ServerName 127.0.0.1
|
||||
|
||||
IncludeOptional /etc/apache2/includes.conf
|
||||
|
||||
Timeout 300
|
||||
KeepAlive On
|
||||
MaxKeepAliveRequests 100
|
||||
KeepAliveTimeout 5
|
||||
|
||||
<IfModule unixd_module>
|
||||
User ${APACHE_RUN_USER}
|
||||
Group ${APACHE_RUN_GROUP}
|
||||
</IfModule>
|
||||
|
||||
HostnameLookups Off
|
||||
|
||||
LogLevel warn
|
||||
|
||||
<IfModule log_config_module>
|
||||
SetEnvIf Request_URI "^/(robots\.txt|favicon\.ico|status|ping|apache-status)$" exclude_from_logs
|
||||
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %O" common
|
||||
LogFormat "%{Referer}i -> %U" referer
|
||||
LogFormat "%{User-agent}i" agent
|
||||
|
||||
CustomLog ${APACHE_CUSTOM_LOG} vhost_combined env=!exclude_from_logs
|
||||
</IfModule>
|
||||
|
||||
ErrorLog /proc/self/fd/2
|
||||
|
||||
LogLevel warn
|
||||
|
||||
<IfModule mpm_event_module>
|
||||
StartServers 2
|
||||
MinSpareThreads 25
|
||||
MaxSpareThreads 75
|
||||
ThreadLimit 64
|
||||
ThreadsPerChild 25
|
||||
MaxRequestWorkers 150
|
||||
MaxConnectionsPerChild 0
|
||||
</IfModule>
|
||||
|
||||
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
|
||||
<FilesMatch "^\.">
|
||||
Require all denied
|
||||
</FilesMatch>
|
||||
|
||||
ServerTokens ${APACHE_SERVER_TOKENS}
|
||||
|
||||
ServerSignature ${APACHE_SERVER_SIGNATURE}
|
||||
|
||||
TraceEnable Off
|
||||
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
<IfModule status_module>
|
||||
<Location /apache-status>
|
||||
SetHandler server-status
|
||||
Require local
|
||||
</Location>
|
||||
|
||||
ExtendedStatus On
|
||||
|
||||
<IfModule mod_proxy.c>
|
||||
ProxyStatus On
|
||||
</IfModule>
|
||||
</IfModule>
|
@ -0,0 +1,3 @@
|
||||
IncludeOptional /etc/apache2/modules.conf
|
||||
|
||||
IncludeOptional /etc/apache2/conf.d/*.conf
|
@ -0,0 +1,24 @@
|
||||
LoadModule logio_module modules/mod_logio.so
|
||||
LoadModule unixd_module modules/mod_unixd.so
|
||||
LoadModule log_config_module modules/mod_log_config.so
|
||||
LoadModule access_compat_module modules/mod_access_compat.so
|
||||
LoadModule auth_basic_module modules/mod_auth_basic.so
|
||||
LoadModule authn_core_module modules/mod_authn_core.so
|
||||
LoadModule authn_file_module modules/mod_authn_file.so
|
||||
LoadModule authz_core_module modules/mod_authz_core.so
|
||||
LoadModule authz_host_module modules/mod_authz_host.so
|
||||
LoadModule authz_user_module modules/mod_authz_user.so
|
||||
LoadModule dir_module modules/mod_dir.so
|
||||
LoadModule env_module modules/mod_env.so
|
||||
LoadModule filter_module modules/mod_filter.so
|
||||
LoadModule mime_module modules/mod_mime.so
|
||||
LoadModule mpm_event_module modules/mod_mpm_event.so
|
||||
LoadModule negotiation_module modules/mod_negotiation.so
|
||||
LoadModule reqtimeout_module modules/mod_reqtimeout.so
|
||||
LoadModule setenvif_module modules/mod_setenvif.so
|
||||
LoadModule status_module modules/mod_status.so
|
||||
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
|
||||
LoadModule expires_module modules/mod_expires.so
|
||||
LoadModule headers_module modules/mod_headers.so
|
@ -1,10 +0,0 @@
|
||||
max_execution_time = ${ZBX_MAXEXECUTIONTIME}
|
||||
memory_limit = ${ZBX_MEMORYLIMIT}
|
||||
post_max_size = ${ZBX_POSTMAXSIZE}
|
||||
upload_max_filesize = ${ZBX_UPLOADMAXFILESIZE}
|
||||
max_input_time = ${ZBX_MAXINPUTTIME}
|
||||
; always_populate_raw_post_data=-1
|
||||
max_input_vars = 10000
|
||||
date.timezone = ${PHP_TZ}
|
||||
; https://www.php.net/manual/en/security.hiding.php
|
||||
expose_php = ${EXPOSE_WEB_SERVER_INFO}
|
@ -0,0 +1,10 @@
|
||||
include=/etc/php83/php-fpm.d/*.conf
|
||||
|
||||
[global]
|
||||
|
||||
pid = /tmp/php-fpm.pid
|
||||
|
||||
error_log = /dev/fd/2
|
||||
log_level = notice
|
||||
|
||||
daemonize = no
|
@ -0,0 +1,36 @@
|
||||
[zabbix]
|
||||
|
||||
; https://www.php.net/manual/en/security.hiding.php
|
||||
php_value[expose_php] = ${EXPOSE_WEB_SERVER_INFO}
|
||||
|
||||
listen = /tmp/php-fpm.sock
|
||||
|
||||
clear_env = no
|
||||
|
||||
pm = ${PHP_FPM_PM}
|
||||
pm.max_children = ${PHP_FPM_PM_MAX_CHILDREN}
|
||||
pm.start_servers = ${PHP_FPM_PM_START_SERVERS}
|
||||
pm.min_spare_servers = ${PHP_FPM_PM_MIN_SPARE_SERVERS}
|
||||
pm.max_spare_servers = ${PHP_FPM_PM_MAX_SPARE_SERVERS}
|
||||
pm.max_requests = ${PHP_FPM_PM_MAX_REQUESTS}
|
||||
|
||||
slowlog = /dev/fd/1
|
||||
|
||||
php_admin_value[error_log] = /dev/fd/2
|
||||
php_admin_flag[log_errors] = on
|
||||
catch_workers_output = yes
|
||||
|
||||
php_value[session.save_handler] = files
|
||||
php_value[session.save_path] = /var/lib/php/session
|
||||
|
||||
php_value[max_execution_time] = ${ZBX_MAXEXECUTIONTIME}
|
||||
php_value[memory_limit] = ${ZBX_MEMORYLIMIT}
|
||||
php_value[post_max_size] = ${ZBX_POSTMAXSIZE}
|
||||
php_value[upload_max_filesize] = ${ZBX_UPLOADMAXFILESIZE}
|
||||
php_value[max_input_time] = ${ZBX_MAXINPUTTIME}
|
||||
php_value[max_input_vars] = 10000
|
||||
php_value[date.timezone] = ${PHP_TZ}
|
||||
|
||||
; PHP-FPM monitoring
|
||||
pm.status_path = /status
|
||||
ping.path = /ping
|
@ -0,0 +1,30 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:httpd]
|
||||
command = /usr/sbin/%(program_name)s -D FOREGROUND
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
|
||||
startsecs=2
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
|
||||
[program:php-fpm83]
|
||||
command = /usr/sbin/%(program_name)s -F -y /etc/php83/php-fpm.conf
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
|
||||
startsecs=2
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
@ -0,0 +1,35 @@
|
||||
; supervisor config file
|
||||
|
||||
[unix_http_server]
|
||||
file = /tmp/supervisor.sock ; (the path to the socket file)
|
||||
chmod = 0700 ; sockef file mode (default 0700)
|
||||
username = zbx
|
||||
password = password
|
||||
|
||||
[supervisord]
|
||||
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
critical = critical
|
||||
;user = zabbix
|
||||
logfile_maxbytes = 0
|
||||
logfile_backupcount = 0
|
||||
loglevel = info
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
@ -1,14 +1,44 @@
|
||||
Listen 8080
|
||||
|
||||
<VirtualHost *:8080>
|
||||
DocumentRoot /usr/share/zabbix/
|
||||
|
||||
ServerName zabbix
|
||||
DirectoryIndex {HTTP_INDEX_FILE}
|
||||
|
||||
DirectoryIndex ${HTTP_INDEX_FILE}
|
||||
|
||||
AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
|
||||
|
||||
<LocationMatch "/(ping|status)">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
|
||||
SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost"
|
||||
</LocationMatch>
|
||||
|
||||
<Directory "/usr/share/zabbix">
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
|
||||
<FilesMatch \.(php|phar)$>
|
||||
SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
|
||||
<filesMatch "\.(ico)$">
|
||||
ExpiresActive On
|
||||
ExpiresDefault "access plus 1 year"
|
||||
Header append Cache-Control "public"
|
||||
</filesMatch>
|
||||
|
||||
<filesMatch "\.(js|css|png|jpg|jpeg|gif|xml|txt)$">
|
||||
ExpiresActive On
|
||||
ExpiresDefault "access plus 14 day"
|
||||
Header append Cache-Control "public"
|
||||
</filesMatch>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/conf">
|
||||
|
@ -1,88 +1,113 @@
|
||||
LoadModule ssl_module modules/mod_ssl.so
|
||||
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
|
||||
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
|
||||
LoadModule socache_shmcb_module /usr/lib/apache2/modules/mod_socache_shmcb.so
|
||||
|
||||
Listen 8443
|
||||
|
||||
<IfModule mod_ssl.c>
|
||||
<VirtualHost *:8443>
|
||||
DocumentRoot /usr/share/zabbix/
|
||||
ServerName zabbix
|
||||
DirectoryIndex {HTTP_INDEX_FILE}
|
||||
<VirtualHost *:8443>
|
||||
DocumentRoot /usr/share/zabbix/
|
||||
|
||||
AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
|
||||
AddType application/x-httpd-php-source .phps
|
||||
ServerName zabbix
|
||||
|
||||
# Enable/Disable SSL for this virtual host.
|
||||
SSLEngine on
|
||||
DirectoryIndex ${HTTP_INDEX_FILE}
|
||||
|
||||
# intermediate configuration
|
||||
SSLProtocol -all +TLSv1.2 +TLSv1.3
|
||||
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305
|
||||
SSLHonorCipherOrder off
|
||||
SSLSessionTickets off
|
||||
AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
|
||||
AddType application/x-httpd-php-source .phps
|
||||
|
||||
SSLCertificateFile /etc/ssl/apache2/ssl.crt
|
||||
SSLCertificateKeyFile /etc/ssl/apache2/ssl.key
|
||||
# SSLCACertificatePath /etc/ssl/apache2/chain/
|
||||
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
|
||||
|
||||
# enable HTTP/2, if available
|
||||
Protocols h2 http/1.1
|
||||
# Enable/Disable SSL for this virtual host.
|
||||
SSLEngine on
|
||||
|
||||
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
|
||||
Header always set Strict-Transport-Security "max-age=63072000"
|
||||
# intermediate configuration
|
||||
SSLProtocol -all +TLSv1.2 +TLSv1.3
|
||||
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305
|
||||
SSLHonorCipherOrder off
|
||||
SSLSessionTickets off
|
||||
|
||||
<Directory "/usr/share/zabbix">
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
SSLCertificateFile /etc/ssl/apache2/ssl.crt
|
||||
SSLCertificateKeyFile /etc/ssl/apache2/ssl.key
|
||||
# SSLCACertificatePath /etc/ssl/apache2/chain/
|
||||
|
||||
<Directory "/usr/share/zabbix/conf">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
# enable HTTP/2, if available
|
||||
Protocols h2 http/1.1
|
||||
|
||||
<Directory "/usr/share/zabbix/app">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
|
||||
Header always set Strict-Transport-Security "max-age=63072000"
|
||||
|
||||
<Directory "/usr/share/zabbix/include">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
<LocationMatch "/(ping|status)">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
|
||||
<Directory "/usr/share/zabbix/local">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost"
|
||||
</LocationMatch>
|
||||
|
||||
<Directory "/usr/share/zabbix/locale">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
<Directory "/usr/share/zabbix">
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
|
||||
<Directory "/usr/share/zabbix/vendor">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
</IfModule>
|
||||
<FilesMatch \.(php|phar)$>
|
||||
SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
|
||||
<filesMatch "\.(ico)$">
|
||||
ExpiresActive On
|
||||
ExpiresDefault "access plus 1 year"
|
||||
Header append Cache-Control "public"
|
||||
</filesMatch>
|
||||
|
||||
<filesMatch "\.(js|css|png|jpg|jpeg|gif|xml|txt)$">
|
||||
ExpiresActive On
|
||||
ExpiresDefault "access plus 14 day"
|
||||
Header append Cache-Control "public"
|
||||
</filesMatch>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/conf">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/app">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/include">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/local">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/locale">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/vendor">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</files>
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
|
Reference in New Issue
Block a user