Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:web_c7:apache_4 [21.07.2017 21:51. ] – [erster manueller Start] django | centos:web_c7:apache_4 [22.07.2019 14:57. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Alternativer FastCGI Process Manager für den Apache httpd unter CentOS 7.x ====== | ====== Alternativer FastCGI Process Manager für den Apache httpd unter CentOS 7.x ====== | ||
- | {{: | + | {{: |
- | Grundsätzlich gibt es **drei** Varianten, wie die Kommunikation zwischen dem WEB-Server [[http:// | + | Grundsätzlich gibt es **drei** Varianten, wie die Kommunikation zwischen dem WEB-Server [[http:// |
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
* Die PHP Prozesse **müssen __nicht__** mehr zwingend in der gleichen Umgebung wie der Webserver laufen; bzw. im einfachsten Fall wird der PHP-FPMD-Daemon mit anderen User- und Gruppenrechten betrieben als der WEB-Server selbst. | * Die PHP Prozesse **müssen __nicht__** mehr zwingend in der gleichen Umgebung wie der Webserver laufen; bzw. im einfachsten Fall wird der PHP-FPMD-Daemon mit anderen User- und Gruppenrechten betrieben als der WEB-Server selbst. | ||
- | * Die PHP-FPM Prozesse können unabhängig vom Webserver neu gestartet werden. Somit werden keinen | + | * Die PHP-FPM Prozesse können unabhängig vom Webserver neu gestartet werden. Somit werden keinen |
* Durch geschickte Konfiguration des PHP-FPM-Daemon können getrennte und unterschiedliche Pools definiert werden. Bei der Konfiguration dieser Pools kann definiert werden, mit welchen User- und Gruppenrechten der bzw. die Prozesse laufen sollen und bei Bedarf können die PHP-FPM-Prozesse auch in eigenen **// | * Durch geschickte Konfiguration des PHP-FPM-Daemon können getrennte und unterschiedliche Pools definiert werden. Bei der Konfiguration dieser Pools kann definiert werden, mit welchen User- und Gruppenrechten der bzw. die Prozesse laufen sollen und bei Bedarf können die PHP-FPM-Prozesse auch in eigenen **// | ||
* Nicht mehr benötigte PHP-FPM-Prozesse können automatisiert beendet werden, wenn diese nicht mehr benötigt werden sollten. | * Nicht mehr benötigte PHP-FPM-Prozesse können automatisiert beendet werden, wenn diese nicht mehr benötigt werden sollten. | ||
* Durch Verwendung der Option **request_slowlog_timeout** kann definiert werden, wie lange max. auf einen Antwort eines Anfrage gewartet werden soll. Wir dieser Wert überschritten, | * Durch Verwendung der Option **request_slowlog_timeout** kann definiert werden, wie lange max. auf einen Antwort eines Anfrage gewartet werden soll. Wir dieser Wert überschritten, | ||
- | * Durch Verwendung des alternativer FastCGI Process Managers **[[https:// | + | * Durch Verwendung des alternativer FastCGI Process Managers **[[https:// |
Nachfolgend wird in diesem Kapitel beschrieben, | Nachfolgend wird in diesem Kapitel beschrieben, | ||
===== Installation ===== | ===== Installation ===== | ||
- | Die Installation des FastCGI Process Managers **[[https:// | + | Die Installation des FastCGI Process Managers **[[https:// |
# yum install php-fpm -y | # yum install php-fpm -y | ||
Zeile 685: | Zeile 685: | ||
Startet der Server nicht automatisch, | Startet der Server nicht automatisch, | ||
+ | ===== Anbindung an den Apache Webserver ===== | ||
+ | Für die Anbindung des Apache Webservers an unseren nun eingerichteten PHP-FPM-Daemon stellt uns das **IUS-Repository** ein passendes RPM zur Verfügung. | ||
+ | |||
+ | ==== Installation ==== | ||
+ | Wir installieren uns nun dieses RPM wie gewohnt mit Hilfe von **yum**. | ||
+ | # yum install php70u-fpm-httpd | ||
- | FIXME FIXME FIXME // | + | Was uns das Paket **php70u-fpm-httpd** alles mit ins System bringt, zeigt uns der Befehl **rpm** mit der Option **-qil**. |
+ | # rpm -qil php70u-fpm-httpd | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Architecture: | ||
+ | Install Date: Fri 21 Jul 2017 11:55:35 PM CEST | ||
+ | Group : Development/Languages | ||
+ | Size : 715 | ||
+ | License | ||
+ | Signature | ||
+ | Source RPM : php70u-7.0.21-1.ius.centos7.src.rpm | ||
+ | Build Date : Thu 06 Jul 2017 04:28:31 PM CEST | ||
+ | Build Host : 606890-build04.rpmdev.rackspace.com | ||
+ | Relocations : (not relocatable) | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | Apache HTTP Server configuration file for the PHP FastCGI Process Manager. | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ==== Konfiguration ==== | ||
+ | Die Konfiguration unseres Webservers erfolgt über Einträge in einzelnen Konfigurationsdateien, | ||
+ | === 00-proxy.conf === | ||
+ | Damit der Apache Webserver die PHP-Request an den externen | ||
+ | |||
+ | # grep mod_proxy_fcgi / | ||
+ | |||
+ | LoadModule proxy_fcgi_module modules/ | ||
+ | |||
+ | === 00-mpm.conf === | ||
+ | Zur Performanceverbesserung wollen wir den [[http:// | ||
+ | |||
+ | Wir deaktivieren zunächst das Modul **prefork** in dem wir den ersten Eintrag auskommentieren. Anschliessend aktivieren die dritte Option - das Modul **event**. | ||
+ | # vim / | ||
+ | |||
+ | <file apache / | ||
+ | # one of the following LoadModule lines: | ||
+ | |||
+ | # prefork MPM: Implements a non-threaded, | ||
+ | # See: http:// | ||
+ | # Django : 2017-07-22 - Modul prefork deaktiviert | ||
+ | # default: LoadModule mpm_prefork_module modules/ | ||
+ | |||
+ | # worker MPM: Multi-Processing Module implementing a hybrid | ||
+ | # multi-threaded multi-process web server | ||
+ | # See: http:// | ||
+ | # | ||
+ | #LoadModule mpm_worker_module modules/ | ||
+ | |||
+ | # event MPM: A variant of the worker MPM with the goal of consuming | ||
+ | # threads only for connections with active processing | ||
+ | # See: http:// | ||
+ | # | ||
+ | # Django | ||
+ | # mod_php deaktiviert. | ||
+ | # default : #LoadModule mpm_event_module modules/ | ||
+ | LoadModule mpm_event_module modules/ | ||
+ | |||
+ | === php-fpm.conf (FastCGI PM) === | ||
+ | Das grundsätzliche Verhalten des alternativen FastCGI Prozess Managers **php-fpm** wird über die Konfigurationsdatei // | ||
+ | |||
+ | In der Regel lassen wir diese Konfigurationsdatei unangetastet, | ||
+ | # vim / | ||
+ | <file php / | ||
+ | ; FPM Configuration ; | ||
+ | ;;;;;;;;;;;;;;;;;;;;; | ||
+ | |||
+ | ; All relative paths in this configuration file are relative to PHP's install | ||
+ | ; prefix. | ||
+ | |||
+ | ; Include one or more files. If glob(3) exists, it is used to include a bunch of | ||
+ | ; files from a glob(3) pattern. This directive can be used everywhere in the | ||
+ | ; file. | ||
+ | include=/ | ||
+ | |||
+ | ;;;;;;;;;;;;;;;;;; | ||
+ | ; Global Options ; | ||
+ | ;;;;;;;;;;;;;;;;;; | ||
+ | |||
+ | [global] | ||
+ | ; Pid file | ||
+ | ; Default Value: none | ||
+ | pid = / | ||
+ | |||
+ | ; Error log file | ||
+ | ; If it's set to " | ||
+ | ; in a local file. | ||
+ | ; Default Value: / | ||
+ | error_log = / | ||
+ | |||
+ | ; syslog_facility is used to specify what type of program is logging the | ||
+ | ; message. This lets syslogd specify that messages from different facilities | ||
+ | ; will be handled differently. | ||
+ | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) | ||
+ | ; Default Value: daemon | ||
+ | ; | ||
+ | |||
+ | ; syslog_ident is prepended to every message. If you have multiple FPM | ||
+ | ; instances running on the same server, you can change the default value | ||
+ | ; which must suit common needs. | ||
+ | ; Default Value: php-fpm | ||
+ | ; | ||
+ | |||
+ | ; Log level | ||
+ | ; Possible Values: alert, error, warning, notice, debug | ||
+ | ; Default Value: notice | ||
+ | ;log_level = notice | ||
+ | |||
+ | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time | ||
+ | ; interval set by emergency_restart_interval then FPM will restart. A value | ||
+ | ; of ' | ||
+ | ; Default Value: 0 | ||
+ | ; | ||
+ | |||
+ | ; Interval of time used by emergency_restart_interval to determine when | ||
+ | ; a graceful restart will be initiated. | ||
+ | ; accidental corruptions in an accelerator' | ||
+ | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) | ||
+ | ; Default Unit: seconds | ||
+ | ; Default Value: 0 | ||
+ | ; | ||
+ | |||
+ | ; Time limit for child processes to wait for a reaction on signals from master. | ||
+ | ; Available units: s(econds), m(inutes), h(ours), or d(ays) | ||
+ | ; Default Unit: seconds | ||
+ | ; Default Value: 0 | ||
+ | ; | ||
+ | |||
+ | ; The maximum number of processes FPM will fork. This has been design to control | ||
+ | ; the global number of processes when using dynamic PM within a lot of pools. | ||
+ | ; Use it with caution. | ||
+ | ; Note: A value of 0 indicates no limit | ||
+ | ; Default Value: 0 | ||
+ | ; | ||
+ | |||
+ | ; Specify the nice(2) priority to apply to the master process (only if set) | ||
+ | ; The value can vary from -19 (highest priority) to 20 (lower priority) | ||
+ | ; Note: - It will only work if the FPM master process is launched as root | ||
+ | ; - The pool process will inherit the master process priority | ||
+ | ; | ||
+ | ; Default Value: no set | ||
+ | ; | ||
+ | |||
+ | ; Send FPM to background. Set to ' | ||
+ | ; Default Value: yes | ||
+ | daemonize = yes | ||
+ | |||
+ | ; Set open file descriptor rlimit for the master process. | ||
+ | ; Default Value: system defined value | ||
+ | ; | ||
+ | |||
+ | ; Set max core size rlimit for the master process. | ||
+ | ; Possible Values: ' | ||
+ | ; Default Value: system defined value | ||
+ | ; | ||
+ | |||
+ | ; Specify the event mechanism FPM will use. The following is available: | ||
+ | ; - select | ||
+ | ; - poll (any POSIX os) | ||
+ | ; - epoll (linux >= 2.5.44) | ||
+ | ; Default Value: not set (auto detection) | ||
+ | ; | ||
+ | |||
+ | ; When FPM is build with systemd integration, | ||
+ | ; in second, between health report notification to systemd. | ||
+ | ; Set to 0 to disable. | ||
+ | ; Available Units: s(econds), m(inutes), h(ours) | ||
+ | ; Default Unit: seconds | ||
+ | ; Default value: 10 | ||
+ | ; | ||
+ | |||
+ | ;;;;;;;;;;;;;;;;;;;; | ||
+ | ; Pool Definitions ; | ||
+ | ;;;;;;;;;;;;;;;;;;;; | ||
+ | |||
+ | ; Multiple pools of child processes may be started with different listening | ||
+ | ; ports and different management options. | ||
+ | ; used in logs and stats. There is no limitation on the number of pools which | ||
+ | ; FPM can handle. Your system will tell you anyway :) | ||
+ | |||
+ | ; See / | ||
+ | |||
+ | </ | ||
+ | |||
+ | === php-fpm.conf (HTTPD) === | ||
+ | Über die Konfigurationsdatei // | ||
+ | |||
+ | <WRAP center round tip 80%> | ||
+ | Der UNIX-Domain-Socket kann bei Apache 2.4 unter CentOS erst ab Version 2.10 unterstützt - für **CentOS 7** wurde diese Funktion aber nach Apache Version **2.4.6** zurück portiert und kann daher bei Bedarf auch konfiguriert und verwendet werden. | ||
+ | </ | ||
+ | |||
+ | Je nach Umgebung und Konfigurationspräferenzen können diese Optionen entweder global in der Datei // | ||
+ | |||
+ | # vim / | ||
+ | |||
+ | <file apache / | ||
+ | # This configuration requires httpd 2.4 with support for UDS (Unix domain | ||
+ | # sockets). | ||
+ | # to 2.4.6 in EL7. | ||
+ | |||
+ | # The following lines prevent .user.ini files from being viewed by Web clients. | ||
+ | <Files " | ||
+ | Require all denied | ||
+ | </ | ||
+ | |||
+ | # Allow php to handle Multiviews. | ||
+ | AddType text/html .php | ||
+ | |||
+ | # Add index.php to the list of files that will be served as directory indexes. | ||
+ | DirectoryIndex index.php | ||
+ | |||
+ | # Enable http authorization headers. | ||
+ | SetEnvIfNoCase ^Authorization$ " | ||
+ | |||
+ | < | ||
+ | SetHandler " | ||
+ | #SetHandler " | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | === www.conf (Pools) === | ||
+ | Im Verzeichnis // | ||
+ | |||
+ | Diese Vorlage-Datei passen wir nun unseren Gegebenheiten nach an. | ||
+ | # vim / | ||
+ | |||
+ | <file php / | ||
+ | ; the variable $pool can we used in any directive and will be replaced by the | ||
+ | ; pool name (' | ||
+ | [www] | ||
+ | |||
+ | ; Per pool prefix | ||
+ | ; It only applies on the following directives: | ||
+ | ; - ' | ||
+ | ; - ' | ||
+ | ; - ' | ||
+ | ; - ' | ||
+ | ; - ' | ||
+ | ; - ' | ||
+ | ; - ' | ||
+ | ; When not set, the global prefix (or @php_fpm_prefix@) applies instead. | ||
+ | ; Note: This directive can also be relative to the global prefix. | ||
+ | ; Default Value: none | ||
+ | ;prefix = / | ||
+ | |||
+ | ; Unix user/group of processes | ||
+ | ; Note: The user is mandatory. If the group is not set, the default user's group | ||
+ | ; will be used. | ||
+ | user = php-fpm | ||
+ | group = php-fpm | ||
+ | |||
+ | ; The address on which to accept FastCGI requests. | ||
+ | ; Valid syntaxes are: | ||
+ | ; ' | ||
+ | ; a specific port; | ||
+ | ; ' | ||
+ | ; a specific port; | ||
+ | ; ' | ||
+ | ; (IPv6 and IPv4-mapped) on a specific port; | ||
+ | ; '/ | ||
+ | ; Note: This value is mandatory. | ||
+ | listen = 127.0.0.1: | ||
+ | ; WARNING: If you switch to a unix socket, you have to grant your webserver user | ||
+ | ; access to that socket by setting listen.acl_users to the webserver user. | ||
+ | ;listen = / | ||
+ | |||
+ | ; Set listen(2) backlog. | ||
+ | ; Default Value: 511 | ||
+ | ; | ||
+ | |||
+ | ; Set permissions for unix socket, if one is used. In Linux, read/ | ||
+ | ; permissions must be set in order to allow connections from a web server. | ||
+ | ; Default Values: user and group are set as the running user | ||
+ | ; mode is set to 0660 | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | |||
+ | ; When POSIX Access Control Lists are supported you can set them using | ||
+ | ; these options, value is a comma separated list of user/group names. | ||
+ | ; When set, listen.owner and listen.group are ignored | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | |||
+ | ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. | ||
+ | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original | ||
+ | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address | ||
+ | ; must be separated by a comma. If this value is left blank, connections will be | ||
+ | ; accepted from any ip address. | ||
+ | ; Default Value: any | ||
+ | listen.allowed_clients = 127.0.0.1 | ||
+ | |||
+ | ; Specify the nice(2) priority to apply to the pool processes (only if set) | ||
+ | ; The value can vary from -19 (highest priority) to 20 (lower priority) | ||
+ | ; Note: - It will only work if the FPM master process is launched as root | ||
+ | ; - The pool processes will inherit the master process priority | ||
+ | ; | ||
+ | ; Default Value: no set | ||
+ | ; process.priority = -19 | ||
+ | |||
+ | ; Choose how the process manager will control the number of child processes. | ||
+ | ; Possible Values: | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; be alive at the same time. | ||
+ | ; | ||
+ | ; | ||
+ | ; state (waiting to process). If the number | ||
+ | ; of ' | ||
+ | ; number then some children will be created. | ||
+ | ; | ||
+ | ; state (waiting to process). If the number | ||
+ | ; of ' | ||
+ | ; number then some children will be killed. | ||
+ | ; ondemand - no children are created at startup. Children will be forked when | ||
+ | ; new requests will connect. The following parameter are used: | ||
+ | ; | ||
+ | ; can be alive at the same time. | ||
+ | ; | ||
+ | ; an idle process will be killed. | ||
+ | ; Note: This value is mandatory. | ||
+ | pm = dynamic | ||
+ | |||
+ | ; The number of child processes to be created when pm is set to ' | ||
+ | ; maximum number of child processes when pm is set to ' | ||
+ | ; This value sets the limit on the number of simultaneous requests that will be | ||
+ | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. | ||
+ | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP | ||
+ | ; CGI. The below defaults are based on a server without much resources. Don' | ||
+ | ; forget to tweak pm.* to fit your needs. | ||
+ | ; Note: Used when pm is set to ' | ||
+ | ; Note: This value is mandatory. | ||
+ | pm.max_children = 50 | ||
+ | |||
+ | ; The number of child processes created on startup. | ||
+ | ; Note: Used only when pm is set to ' | ||
+ | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 | ||
+ | pm.start_servers = 5 | ||
+ | |||
+ | ; The desired minimum number of idle server processes. | ||
+ | ; Note: Used only when pm is set to ' | ||
+ | ; Note: Mandatory when pm is set to ' | ||
+ | pm.min_spare_servers = 5 | ||
+ | |||
+ | ; The desired maximum number of idle server processes. | ||
+ | ; Note: Used only when pm is set to ' | ||
+ | ; Note: Mandatory when pm is set to ' | ||
+ | pm.max_spare_servers = 35 | ||
+ | |||
+ | ; The number of seconds after which an idle process will be killed. | ||
+ | ; Note: Used only when pm is set to ' | ||
+ | ; Default Value: 10s | ||
+ | ; | ||
+ | |||
+ | ; The number of requests each child process should execute before respawning. | ||
+ | ; This can be useful to work around memory leaks in 3rd party libraries. For | ||
+ | ; endless request processing specify ' | ||
+ | ; Default Value: 0 | ||
+ | ; | ||
+ | |||
+ | ; The URI to view the FPM status page. If this value is not set, no URI will be | ||
+ | ; recognized as a status page. It shows the following informations: | ||
+ | ; | ||
+ | ; | ||
+ | ; start time - the date and time FPM has started; | ||
+ | ; start since - number of seconds since FPM has started; | ||
+ | ; | ||
+ | ; | ||
+ | ; connections (see backlog in listen(2)); | ||
+ | ; max listen queue - the maximum number of requests in the queue | ||
+ | ; of pending connections since FPM has started; | ||
+ | ; | ||
+ | ; idle processes | ||
+ | ; | ||
+ | ; total processes | ||
+ | ; max active processes - the maximum number of active processes since FPM | ||
+ | ; has started; | ||
+ | ; max children reached - number of times, the process limit has been reached, | ||
+ | ; when pm tries to start more children (works only for | ||
+ | ; pm ' | ||
+ | ; Value are updated in real time. | ||
+ | ; Example output: | ||
+ | ; | ||
+ | ; | ||
+ | ; start time: | ||
+ | ; start since: | ||
+ | ; | ||
+ | ; | ||
+ | ; max listen queue: | ||
+ | ; | ||
+ | ; idle processes: | ||
+ | ; | ||
+ | ; total processes: | ||
+ | ; max active processes: 12 | ||
+ | ; max children reached: 0 | ||
+ | ; | ||
+ | ; By default the status page output is formatted as text/plain. Passing either | ||
+ | ; ' | ||
+ | ; output syntax. Example: | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; By default the status page only outputs short status. Passing ' | ||
+ | ; query string will also return status for each pool process. | ||
+ | ; Example: | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; The Full status returns for each process: | ||
+ | ; | ||
+ | ; | ||
+ | ; start time - the date and time the process has started; | ||
+ | ; start since - the number of seconds since the process has started; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; last request cpu - the %cpu the last request consumed | ||
+ | ; it's always 0 if the process is not in Idle state | ||
+ | ; because CPU calculation is done when the request | ||
+ | ; processing has terminated; | ||
+ | ; last request memory | ||
+ | ; it's always 0 if the process is not in Idle state | ||
+ | ; because memory calculation is done when the request | ||
+ | ; processing has terminated; | ||
+ | ; If the process is in Idle state, then informations are related to the | ||
+ | ; last request the process has served. Otherwise informations are related to | ||
+ | ; the current request being served. | ||
+ | ; Example output: | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; start time: | ||
+ | ; start since: | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ; last request cpu: | ||
+ | ; last request memory: | ||
+ | ; | ||
+ | ; Note: There is a real-time FPM status monitoring sample web page available | ||
+ | ; | ||
+ | ; | ||
+ | ; Note: The value must start with a leading slash (/). The value can be | ||
+ | ; | ||
+ | ; may conflict with a real PHP file. | ||
+ | ; Default Value: not set | ||
+ | ; | ||
+ | |||
+ | ; The ping URI to call the monitoring page of FPM. If this value is not set, no | ||
+ | ; URI will be recognized as a ping page. This could be used to test from outside | ||
+ | ; that FPM is alive and responding, or to | ||
+ | ; - create a graph of FPM availability (rrd or such); | ||
+ | ; - remove a server from a group if it is not responding (load balancing); | ||
+ | ; - trigger alerts for the operating team (24/7). | ||
+ | ; Note: The value must start with a leading slash (/). The value can be | ||
+ | ; | ||
+ | ; may conflict with a real PHP file. | ||
+ | ; Default Value: not set | ||
+ | ;ping.path = /ping | ||
+ | |||
+ | ; This directive may be used to customize the response of a ping request. The | ||
+ | ; response is formatted as text/plain with a 200 response code. | ||
+ | ; Default Value: pong | ||
+ | ; | ||
+ | |||
+ | ; The access log file | ||
+ | ; Default: not set | ||
+ | ;access.log = log/ | ||
+ | |||
+ | ; The access log format. | ||
+ | ; The following syntax is allowed | ||
+ | ; %%: the ' | ||
+ | ; %C: %CPU used by the request | ||
+ | ; it can accept the following format: | ||
+ | ; - %{user}C for user CPU only | ||
+ | ; - %{system}C for system CPU only | ||
+ | ; - %{total}C | ||
+ | ; %d: time taken to serve the request | ||
+ | ; it can accept the following format: | ||
+ | ; - %{seconds}d (default) | ||
+ | ; - %{miliseconds}d | ||
+ | ; - %{mili}d | ||
+ | ; - %{microseconds}d | ||
+ | ; - %{micro}d | ||
+ | ; %e: an environment variable (same as $_ENV or $_SERVER) | ||
+ | ; it must be associated with embraces to specify the name of the env | ||
+ | ; variable. Some exemples: | ||
+ | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e | ||
+ | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e | ||
+ | ; %f: script filename | ||
+ | ; %l: content-length of the request (for POST request only) | ||
+ | ; %m: request method | ||
+ | ; %M: peak of memory allocated by PHP | ||
+ | ; it can accept the following format: | ||
+ | ; - %{bytes}M (default) | ||
+ | ; - %{kilobytes}M | ||
+ | ; - %{kilo}M | ||
+ | ; - %{megabytes}M | ||
+ | ; - %{mega}M | ||
+ | ; %n: pool name | ||
+ | ; %o: output header | ||
+ | ; it must be associated with embraces to specify the name of the header: | ||
+ | ; - %{Content-Type}o | ||
+ | ; - %{X-Powered-By}o | ||
+ | ; - %{Transfert-Encoding}o | ||
+ | ; - .... | ||
+ | ; %p: PID of the child that serviced the request | ||
+ | ; %P: PID of the parent of the child that serviced the request | ||
+ | ; %q: the query string | ||
+ | ; %Q: the '?' | ||
+ | ; %r: the request URI (without the query string, see %q and %Q) | ||
+ | ; %R: remote IP address | ||
+ | ; %s: status (response code) | ||
+ | ; %t: server time the request was received | ||
+ | ; it can accept a strftime(3) format: | ||
+ | ; %d/ | ||
+ | ; The strftime(3) format must be encapsuled in a %{< | ||
+ | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H: | ||
+ | ; %T: time the log has been written (the request has finished) | ||
+ | ; it can accept a strftime(3) format: | ||
+ | ; %d/ | ||
+ | ; The strftime(3) format must be encapsuled in a %{< | ||
+ | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H: | ||
+ | ; %u: remote user | ||
+ | ; | ||
+ | ; Default: "%R - %u %t \"%m %r\" %s" | ||
+ | ; | ||
+ | |||
+ | ; The log file for slow requests | ||
+ | ; Default Value: not set | ||
+ | ; Note: slowlog is mandatory if request_slowlog_timeout is set | ||
+ | slowlog = / | ||
+ | |||
+ | ; The timeout for serving a single request after which a PHP backtrace will be | ||
+ | ; dumped to the ' | ||
+ | ; Available units: s(econds)(default), | ||
+ | ; Default Value: 0 | ||
+ | ; | ||
+ | |||
+ | ; The timeout for serving a single request after which the worker process will | ||
+ | ; be killed. This option should be used when the ' | ||
+ | ; does not stop script execution for some reason. A value of ' | ||
+ | ; Available units: s(econds)(default), | ||
+ | ; Default Value: 0 | ||
+ | ; | ||
+ | |||
+ | ; Set open file descriptor rlimit. | ||
+ | ; Default Value: system defined value | ||
+ | ; | ||
+ | |||
+ | ; Set max core size rlimit. | ||
+ | ; Possible Values: ' | ||
+ | ; Default Value: system defined value | ||
+ | ; | ||
+ | |||
+ | ; Chroot to this directory at the start. This value must be defined as an | ||
+ | ; absolute path. When this value is not set, chroot is not used. | ||
+ | ; Note: you can prefix with ' | ||
+ | ; of its subdirectories. If the pool prefix is not set, the global prefix | ||
+ | ; will be used instead. | ||
+ | ; Note: chrooting is a great security feature and should be used whenever | ||
+ | ; | ||
+ | ; | ||
+ | ; Default Value: not set | ||
+ | ;chroot = | ||
+ | |||
+ | ; Chdir to this directory at the start. | ||
+ | ; Note: relative path can be used. | ||
+ | ; Default Value: current directory or / when chroot | ||
+ | ;chdir = /var/www | ||
+ | |||
+ | ; Redirect worker stdout and stderr into main error log. If not set, stdout and | ||
+ | ; stderr will be redirected to /dev/null according to FastCGI specs. | ||
+ | ; Note: on highloaded environement, | ||
+ | ; process time (several ms). | ||
+ | ; Default Value: no | ||
+ | ; | ||
+ | |||
+ | ; Clear environment in FPM workers | ||
+ | ; Prevents arbitrary environment variables from reaching FPM worker processes | ||
+ | ; by clearing the environment in workers before env vars specified in this | ||
+ | ; pool configuration are added. | ||
+ | ; Setting to " | ||
+ | ; via getenv(), $_ENV and $_SERVER. | ||
+ | ; Default Value: yes | ||
+ | ;clear_env = no | ||
+ | |||
+ | ; Limits the extensions of the main script FPM will allow to parse. This can | ||
+ | ; prevent configuration mistakes on the web server side. You should only limit | ||
+ | ; FPM to .php extensions to prevent malicious users to use other extensions to | ||
+ | ; exectute php code. | ||
+ | ; Note: set an empty value to allow all extensions. | ||
+ | ; Default Value: .php | ||
+ | ; | ||
+ | |||
+ | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from | ||
+ | ; the current environment. | ||
+ | ; Default Value: clean env | ||
+ | ; | ||
+ | ;env[PATH] = / | ||
+ | ;env[TMP] = /tmp | ||
+ | ; | ||
+ | ;env[TEMP] = /tmp | ||
+ | |||
+ | ; Additional php.ini defines, specific to this pool of workers. These settings | ||
+ | ; overwrite the values previously defined in the php.ini. The directives are the | ||
+ | ; same as the PHP SAPI: | ||
+ | ; | ||
+ | ; be overwritten from PHP call ' | ||
+ | ; | ||
+ | ; PHP call ' | ||
+ | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. | ||
+ | |||
+ | ; Defining ' | ||
+ | ; extension_dir. Defining ' | ||
+ | ; overwrite previously defined php.ini values, but will append the new value | ||
+ | ; instead. | ||
+ | |||
+ | ; Note: path INI options can be relative and will be expanded with the prefix | ||
+ | ; (pool, global or @prefix@) | ||
+ | |||
+ | ; Default Value: nothing is defined by default except the values in php.ini and | ||
+ | ; specified at startup with the -d argument | ||
+ | ; | ||
+ | ; | ||
+ | php_admin_value[error_log] = / | ||
+ | php_admin_flag[log_errors] = on | ||
+ | ; | ||
+ | |||
+ | ; Set data paths to directories owned by process user | ||
+ | php_value[session.save_handler] = files | ||
+ | php_value[session.save_path] | ||
+ | php_value[soap.wsdl_cache_dir] | ||
+ | ; | ||
+ | |||
+ | </ | ||
+ | |||
+ | Auf folgende Parameter werfen wir nun ein besonderes Augenmerk: | ||
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
+ | SetHandler " | ||
+ | AuthType Basic | ||
+ | AuthName "Fuer den Zugriff auf den Webserver bitte Anmeldedaten eingeben!" | ||
+ | AuthBasicProvider ldap | ||
+ | AuthLDAPUrl ldaps:// | ||
+ | AuthLDAPBindDN cn=Technischer_User, | ||
+ | AuthLDAPBindPassword " | ||
+ | AuthLDAPBindAuthoritative on | ||
+ | Require ldap-user webserver-admin | ||
+ | </ | ||
+ | </ | ||
+ | process manager: | ||
+ | start time: | ||
+ | start since: | ||
+ | accepted conn: 2723 | ||
+ | listen queue: | ||
+ | max listen queue: | ||
+ | listen queue len: 128 | ||
+ | idle processes: | ||
+ | active processes: | ||
+ | total processes: | ||
+ | max active processes: 3 | ||
+ | max children reached: 0 | ||
+ | slow requests: | ||
+ | Nachfolgendes Beispiel zeigt exemplarisch die detailierte html-Ausgabe. {{ : | ||
+ | * **'' | ||
+ | * **'' | ||
+ | |||
+ | ==== Aktivieren der Programmänderungen ==== | ||
+ | Zum Aktiveren unsere durchgeführten Konfigurationsänderungen starten wir nun einmal den Apache-Webserver durch. Zuvor überprüfen wir aber noch, ob sich in den Apache-Konfigurationsdateien ein syntaktischer Fehler eingeschlichen hat. | ||
+ | # apachectl -t | ||
+ | |||
+ | Syntax OK | ||
+ | |||
+ | Nun können wir den HTTP-Daemon einmal durchstarten | ||
+ | # systemctl restart httpd.service | ||
+ | |||
+ | Den erfolgreichen Neustart des Webservers können wir nun auch abfragen. | ||
+ | # systemctl status httpd.service | ||
+ | |||
+ | < | ||
+ | <font style=" | ||
+ | | ||
+ | | ||
+ | Docs: man: | ||
+ | | ||
+ | Process: 9894 ExecStop=/ | ||
+ | Process: 12446 ExecReload=/ | ||
+ | Main PID: 9898 (httpd) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Aug 07 22:21:37 vml000107.dmz.nausch.org systemd[1]: Starting The Apache HTTP Server... | ||
+ | Aug 07 22:21:37 vml000107.dmz.nausch.org systemd[1]: Started The Apache HTTP Server.</ | ||
+ | </ | ||
+ | |||
+ | Anschließend starten wir den **PHP-FPM**-Daemon einmal durch. | ||
+ | # systemctl restart php-fpm.service | ||
+ | |||
+ | Auch hier können wir den erfolgreichen Restart abfragen. | ||
+ | |||
+ | |||
+ | < | ||
+ | <font style=" | ||
+ | | ||
+ | | ||
+ | Main PID: 10260 (php-fpm) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Aug 07 22:28:33 vml000107.dmz.nausch.org systemd[1]: Starting The PHP FastCGI Process Manager... | ||
+ | Aug 07 22:28:33 vml000107.dmz.nausch.org systemd[1]: Started The PHP FastCGI Process Manager.</ | ||
+ | </ | ||
+ | |||
+ | Alternativ dazu kann auch mit nachfolgendem Befehlsaufruf überprüft werden welche Prozesse mit den zugehörigen Pools gestartet wurden. | ||
+ | # ps auxwwwf | grep php | ||
+ | < | ||
+ | root | ||
+ | php-fpm | ||
+ | php-fpm | ||
+ | php-fpm | ||
+ | php-fpm | ||
+ | php-fpm | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | apache | ||
+ | php-fpm | ||
+ | |||
+ | ===== Überprüfung der verwendeten PHP-API ===== | ||
+ | Zum Schluss wollen wir noch prüfen, ob auch wirklich die gewünschte PHP-API sich in Verwendung befindet. Hierzu legen wir eine einfache Textdatei im Document-ROOT unseres Webservers ab und rufen die zugehörige UIR über den Browser unserer Wahl auf. | ||
+ | |||
+ | ==== PHP Info bei Verwendung von mod_php ==== | ||
+ | Das erste Beispiel zeigt die Verwendung des **//Apache 2.0 Handlers// | ||
+ | # echo '<? | ||
+ | |||
+ | $ firefox 10.0.0.107/ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | # rm / | ||
+ | |||
+ | Da die Datei **info.php** nur zu Demozwecken notwendig war, können wir dies nun auch wieder löschen. | ||
+ | ==== PHP Info bei Verwendung von php-fpm ==== | ||
+ | Das zweite Beispiel zeigt die erfolgreiche Verwendung des alternativen //**FastCGI Prozess Managers**//: | ||
+ | # echo '<? | ||
+ | |||
+ | $ firefox 10.0.0.107/ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Da auch hier dies nur ein Demonstrationszweck war, entfernen wir auch hier wieder die zuvor angelegte Testdatei **info.php**. | ||
+ | # rm / | ||
+ | |||
+ | ====== Links ====== | ||
+ | * **[[centos: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||