Remi's RPM repository - Blog - Mot-clé - FPMRemi's RPM repository blog Information about RPM PHP Fedora RHEL and CentOS2024-03-28T14:46:28+01:00Remi Colleturn:md5:04ca934806743f3bda12513f927cafa9DotclearPHP Configuration Tipsurn:md5:c3abe5576f7a6bd06493b98cec88f6692017-10-28T10:00:00+02:002017-10-28T09:59:49+02:00RemiHowToCentOSFPMPHPRHELSCL <p><strong>Read</strong>: <a href="https://developers.redhat.com/blog/2017/10/25/php-configuration-tips/">PHP Configuration Tips</a></p>
<p>This article provides refreshed information published here during recent years.</p>
<p><strong>Notice</strong>: starting with Fedora 27, the default PHP configuration uses FPM, as explained in this article.</p>
<p> </p>Astuces de configuration de PHPurn:md5:d4eb0ea1c7c500d88212bad9dac647522017-10-28T08:48:00+02:002017-10-28T09:15:15+02:00RemiHowToCentOSFPMPHPplanetlibreplanetphpfrRHELSCL<p>Traduction de l'article <a href="https://developers.redhat.com/blog/2017/10/25/php-configuration-tips/">PHP Configuration Tips</a>.</p>
<p>Cet article regroupe les informations actualisées qui ont été publiées ici au cours des dernières années.</p> <p class="selectionShareable"><strong>RHEL 7</strong> fournit le serveur HTTP Apache version 2.4 et PHP version 5.4.</p>
<p class="selectionShareable">Le configuration la plus commune pour Apache et PHP utilise mod_php, mais présente quelques limites et inconvénients :</p>
<ul>
<li>une seule version de mod_php peut être utilisée</li>
<li>mod_php tourne dans le processus httpd, sans isolation</li>
<li>mod_php n'est supporté que pour le MPM <em>prefork</em></li>
</ul>
<p class="selectionShareable">Cet article explique comment déléguer l'exécution des scripts PHP à un service d'arrière plan utilisant le protocole <strong>FastCGI</strong>, comment utiliser une <strong>version récente de PHP</strong>, comment utiliser <strong>plusieurs versions de PHP</strong>, et comment améliorer les <strong>performances</strong> d'Apache..</p>
<p class="selectionShareable">Le paquet du serveur HTTP d'apache disponible dans RHEL fournit l'ensemble des fonctionnalités nécessaires pour une telle configuration.</p>
<h2>1. Basculer vers php-fpm</h2>
<h3>1.1. Supprimer mod_php</h3>
<p class="selectionShareable">Il est conseillé de supprimer ou de désactiver mod_php afin de réduire la consommation mémoire de chaque processus httpd.</p>
<p class="selectionShareable">Vous pouvez soit désinstaller le paquet <strong>php</strong>, qui ne contient que ce module</p>
<pre>
yum remove php</pre>
<p class="selectionShareable">ou simplement le désactiver en commentant la directive <em>LoadModule</em> directive dans le fichier /etc/httpd/conf.modules.d/10-php.conf.</p>
<pre>
# disabled # LoadModule php5_module modules/libphp5.so</pre>
<h3>1.2. Installer php-fpm</h3>
<p class="selectionShareable">Vous pouvez maintenant installer php-fpm et activer son service</p>
<pre>
yum install php-fpm
systemctl start php-fpm
systemctl enable php-fpm</pre>
<p class="selectionShareable">Remarque: le paquet <strong>php-fpm</strong> est disponible dans le canal <em><strong>optional</strong></em>, qui doit donc être activé.</p>
<p class="selectionShareable">Pour configurer l'exécution des scripts PHP, modifiez ou créez le fichier de configuration /etc/httpd/conf.d/php.conf :</p>
<p class="selectionShareable">Les lignes suivantes interdise l'accès aux fichiers .user.ini depuis les clients Web!</p>
<pre>
<Files ".user.ini">
Require all denied
</Files></pre>
<p class="selectionShareable">Activation de la gestion du <em>Multiviews</em> par php:</p>
<pre>
AddType text/html .php</pre>
<p class="selectionShareable">Ajouter index.php à la liste des fichiers utilisés pour fournir le contenu d'un dossier :</p>
<pre>
DirectoryIndex index.php</pre>
<p class="selectionShareable">La ligne suivante active les entêtes d'autorisation :</p>
<pre>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1</pre>
<p class="selectionShareable">Rediriger l'exécution des scripts PHP vers le service FPM</p>
<pre>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch></pre>
<p class="selectionShareable">Si des directives <strong>php_value</strong> sont présentes dans ce fichier, vous devez les supprimer, elles ne concernent que mod_php.</p>
<p class="selectionShareable">Vous pouvez maintenant redémarrer le serveur web et, avec une simple page de test</p>
<pre>
<?php phpinfo();</pre>
<p class="selectionShareable">vérifier qui PHP est désormais exécuté à par le service FastCGI:</p>
<pre>
PHP Version 5.4.16
Server API= FPM/FastCGI</pre>
<h3>1.3. Réglages de PHP</h3>
<p class="selectionShareable">Le fichier de configuration principal est /etc/php-fpm.conf, qui contient beaucoup de commentaires expliquant chaque option.</p>
<p class="selectionShareable">FPM peut exécuter plusieurs services (<em>pool</em>), chacun exécutant les scripts PHP avec des options pouvant être différentes, le fichier de configuration du service par défaut (www) est /etc/php-fpm.d/www.conf, qui contient aussi de nombreux commentaires.</p>
<h4>1.3.1. php_value, php-flag</h4>
<p class="selectionShareable">Les options de PHP peuvent être configurées en utilisant les directives <em>php_value, php_admin_value,</em> <em>php_flag</em> et <em>php_admin_flag</em> :</p>
<ul>
<li>avec mod_php, dans les fichiers de configuration d'Apache</li>
<li>avec FPM, dans les fichiers de configuration des services (<em>pool</em>)</li>
</ul>
<h4>1.3.2. .htaccess</h4>
<p class="selectionShareable">Les options peuvent, en plus, être définies pour un dossier spécifique :</p>
<ul>
<li>avec mod_php, en utilisant un fichier <strong>.htaccess</strong></li>
<li>avec FPM, en utulisation un fichier <strong>.user.ini</strong> (les mot clés php_* ne sont pas nécessaires).</li>
</ul>
<h4>1.3.3. Réglages des processus</h4>
<p class="selectionShareable">FPM fonctionne en service et lance plusieurs processus pour gérer les différentes requêtes en parallèle, il existe plusieurs modes :</p>
<ul>
<li>pm = ondemand, un processus est lancé uniquement lors d'une nouvelle connexion, et arrêté lorsqu'il n'y a pas d'activité, ce mode est adapté pour les environnements de développement</li>
<li>pm = dynamic, un groupe de processus est toujours en fonctionnement, plus de processus seront démarrés en cas de besoin, ce mode adapté à la production</li>
<li>pm = static, un nombre fixe de processus est toujours présent, ce mode est adapté à la production et peut améliorer les performances</li>
</ul>
<h3>1.4. Réglages du Serveur HTTP Apache</h3>
<h4>1.4.1. Mode <em>threadé</em></h4>
<p class="selectionShareable">Par défaut, le serveur HTTP apache utilise un ensemble de processus pour gérer les requêtes entrantes (MPM <em>prefork</em>).</p>
<p class="selectionShareable">Comme nous n'utilisons plus mod_php, nous pouvons basculer sur un MPM <em>threadé</em> (<em>worker</em> ou <em>event</em>), et c'est un ensemble de threads qui gérera les requêtes, réduisant le nombre de processus, la consommation mémoire, et améliorant les performances, en particulier lorsqu'il s'agit de servir de nombreux fichiers statiques.</p>
<p class="selectionShareable">Changer le MPM utilisé dans le fichier de configuration /etc/httpd/conf.modules.d/00-mpm.conf :</p>
<pre>
# disabled # LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
# disabled # LoadModule mpm_worker_module modules/mod_mpm_worker.so
LoadModule mpm_event_module modules/mod_mpm_event.so</pre>
<h4>1.4.2. Unix Domain Socket</h4>
<p class="selectionShareable">Par défaut, FPM écoute sur un socket réseau, mais il peut aussi utiliser un socket local (UDS), ce qui peut améliorer sensiblement les performances :</p>
<p class="selectionShareable">Dans la configuration du service (<em>pool</em>) <strong>FPM</strong> :</p>
<pre>
listen = /run/php-fpm/www.sock
listen.owner = apache
listen.mode = 0660</pre>
<p class="selectionShareable">Dans la configuration du serveur <strong>Apache</strong> :</p>
<pre>
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"</pre>
<h4>1.4.2. Séparation du frontal et des serveurs applicatifs</h4>
<p class="selectionShareable">Par défaut, FPM écoute les requêtes entrantes sur un socket réseau local, il est évidement possible d'utiliser un serveur séparé, une machine virtuelle ou un conteneur (une instance docker)</p>
<p class="selectionShareable">Dans le configuration du service (<em>pool</em>) <strong>FPM</strong> :</p>
<pre>
listen = 10.0.0.2:9000
listen.allowed_clients = 10.0.0.1</pre>
<p class="selectionShareable">Dans la configuration du serveur <strong>Apache </strong>:</p>
<pre>
SetHandler "proxy:fcgi://10.0.0.2:9000"</pre>
<h4>1.4.3 Plusieurs serveurs applicatifs</h4>
<p class="selectionShareable">Pour traiter plus de requêtes simultanément, vous pouvez désirer répartir la charger entre plusieurs serveurs PHP, ce qui est très facile.</p>
<p class="selectionShareable">Exemple de configuration du serveur <strong>Apache</strong> avec 3 serveurs applicatifs :</p>
<pre>
# Création du répartiteur de charge
<Proxy balancer://phpfpmlb>
BalancerMember fcgi://10.0.0.2:9000
BalancerMember fcgi://10.0.0.3:9000
BalancerMember fcgi://10.0.0.4:9000
</Proxy>
# Redirection de l'exécution des scripts PHP
<FilesMatch \.php$>
SetHandler "proxy:balancer://phpfpmlb"
</FilesMatch></pre>
<h2>2. Utilisation d'une version récente de PHP</h2>
<p class="selectionShareable">RHEL fournit PHP version <strong>5.4</strong>, qui était la version courante lors de la publication de RHEL-7, mais qui peut être trop ancienne pour des projets récents.</p>
<p class="selectionShareable">Les versions <strong>5.6</strong>, <strong>7.0</strong> et <strong>7.1</strong> de PHP sont maintenant supportées sur RHEL, fournies dans le produit <em>Red Hat Software Collection</em>s (<a href="https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/2/html/2.4_Release_Notes/index.html">RHSCL</a>).</p>
<p class="selectionShareable">Dans l'example ci-dessous, nous utiliserons la version 7.0, mais s'applique à l'identique pour les autres versions.</p>
<h3><strong>2.1. Installation</strong></h3>
<p class="selectionShareable">Installation de la <em>Software Collection</em>, après avoir activé le canal RHSCL:</p>
<pre>
yum install rh-php70</pre>
<p class="selectionShareable">Installation du service FPM service pour cette version:</p>
<pre>
yum install rh-php70-php-fpm</pre>
<p class="selectionShareable">Installation des extensions supplémentaires nécessaires :</p>
<pre>
yum install rh-php70-php-mbstring rh-php70-php-pgsql rh-php70-php-opcache</pre>
<p class="selectionShareable"><strong>Astuce</strong> : comparer la liste des extensions disponibles, pour s'assurer que tout ce qui est nécessaire est présent.</p>
<pre>
php --modules | tee /tmp/54
scl enable rh-php70 'php --modules' | tee /tmp/70
diff /tmp/54 /tmp/70</pre>
<p class="selectionShareable"><strong>Astuce </strong>: ne jamais se fier au nom des paquets, mais préférer le nom des extensions (e.g. php-mysqli ou rh-php70-php-simplexml), en effet le découpage des paquets peut changer entre les versions.</p>
<h3>2.2. Utiliser une nouvelle version de PHP</h3>
<p class="selectionShareable">Lorsqu'on utilise FPM, c'est aussi simple que d’arrêter l'ancien service et de démarrer le nouveau:</p>
<pre>
systemctl stop php-fpm
systemctl start rh-php70-php-fpm</pre>
<h3>2.3. Paquet additionnels</h3>
<p class="selectionShareable">Les <em>Software Collections</em> fournissent les même extensions que les paquets standards de RHEL.</p>
<p class="selectionShareable">Les utilisateurs sont habitués à trouver des extensions supplémentaires dans le dépôt <a href="https://fedoraproject.org/wiki/EPEL">EPEL</a>, de la même manière, des extensions sont disponibles dans le dépôt communautaire <strong>centos-sclo-sclo</strong>, pour plus d'information, cherchez <strong>sclo-php</strong> sur le site <a href="https://www.softwarecollections.org/en/scls/?search=sclo-php">https://www.softwarecollections.org/</a>.</p>
<h2>3. Utiliser plusieurs versions de PHP</h2>
<p class="selectionShareable">Puisque l'exécution de PHP est redirigée version le service FastCGI service par la directive <strong>SetHandler</strong>, elle peut être définie pour chaque hôte virtuel, chaque projet ou chaque dossier.</p>
<p class="selectionShareable">Dans l'exemple ci-dessous, nous utiliserons PHP version 5.4 du système de base (pour des applications anciennes, qui a été configuré précédemment) et PHP version 7.1 simultanément.</p>
<h3>3.1. Installation</h3>
<p class="selectionShareable">Installation de la <em>Software Collection</em>, après avoir activé le canal RHSCL:</p>
<pre>
yum install rh-php71 rh-php71-php-fpm rh-php71-php-mbstring rh-php71-php-opcache ...</pre>
<p class="selectionShareable">Configuration de FPM pour écouter sur un port différent de celui utilisé par le service php-fpm service par défaut, dans le fichier /etc/opt/rh/rh-php71/php-fpm.d/www.conf.</p>
<pre>
listen = 127.0.0.1:9071</pre>
<p class="selectionShareable">Configurer SELinux pour ne pas bloquer ce port :</p>
<pre>
semanage port -a -t http_port_t -p tcp 9071</pre>
<p class="selectionShareable">Démarrer le service :</p>
<pre>
systemctl start rh-php71-php-fpm</pre>
<p class="selectionShareable">Il est désormais possible de choisir la version de PHP utilisée pour chaque dossier dans le fichier de configuration du serveur Apache :</p>
<p class="selectionShareable">Exemple:</p>
<pre>
# Utiliser PHP 7.1 par défaut
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9071"
</FilesMatch>
# Utiliser PHP 5.4 pour une ancienne application
<Directory /var/www/html/old>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
</Directory></pre>
<h2>4. Conclusion</h2>
<p class="selectionShareable">J'espère que ce petit article a mis en évidence les nombreux bénéfices de basculer sur FPM pour vos applications PHP:</p>
<ul>
<li>isolation des processus entre le frontal web (httpd) et les serveurs applicatifs (fpm)</li>
<li>amélioration des performances</li>
<li>utilisation des versions modernes de PHP</li>
<li>utilisation de plusieurs versions de PHP</li>
</ul>PHP Tour 2016 Clermont-Ferrandurn:md5:b7cb6a3f18c84903a2063dfda4c519cf2016-05-27T10:27:00+02:002016-08-13T17:39:54+02:00RemiGeneralAmbassadeurApacheFPMPHPplanetlibreplanetphpfr <p>J'ai eu le plaisir de participer au <a href="http://event.afup.org/forum-php-2016/">PHP Tour 2016</a> à Clermont-Ferrand.</p>
<p>J'y ai donné une conférence "<strong>Oublions mod_php</strong>". Il s'agit de revenir sur cette méthode d'installation de PHP, la plus documentée et la plus simple, mais qui a souvent nuit à l'image d'<a href="http://httpd.apache.org/">Apache HTTPD Server</a>, et entrainé une migration d'utilisateurs en recherche de performances vers <a href="http://nginx.org/">nginx</a> avec son modèle <em>threadé</em>. et donc l'utilisation de <a href="http://php.net/fpm">FPM</a>. Alors qu'il est tout à fait possible d'utiliser apache en mode <em>threadé</em> avec les MPM <a href="http://httpd.apache.org/docs/2.4/mod/worker.html">worker</a> ou <a href="http://httpd.apache.org/docs/2.4/mod/event.html">event</a> en utilisant FPM.</p>
<p>C'est aussi l'occasion de montrer à quel point il est aisé de passer a une configuration d'apache + FPM, simple ou avancée:</p>
<ul>
<li>remplacer mod_php par php-fpm</li>
<li>plusieurs versions de PHP</li>
<li>répartition de charge</li>
</ul>
<p>La présentation : <a href="https://blog.remirepo.net/public/Docs/Clermont2016.pdf">Clermont2016.pdf</a></p>
<p>Événement sur Joind : <a href="https://joind.in/event/php-tour-clermont-ferrand-2016/oublions-modphp">Oublions mod_php</a></p>
<p>Et comme chaque année, ce nouveau PHP Tout a été l'occasion de rencontres particulièrement enrichissantes avec les développeurs et utilisateurs de PHP.</p>
<p>Média : <a href="https://twitter.com/sanplomb/status/734757417058205696/photo/1">@sanplomb</a> <a href="https://www.flickr.com/photos/julienpauli/27158812501/in/album-72157668502975061/">j.pauli 1</a>, <a href="https://www.flickr.com/photos/julienpauli/27193804836/in/album-72157668502975061/">j.pauli 2</a></p>
<p>Bientôt le PHP Forum 2016 à Paris.</p>
<p> </p>Apache HTTP Server and load balancing to PHP FPMurn:md5:0de103f1ddcb5be60d7e99fc27f022bb2015-09-17T14:39:00+02:002016-12-05T13:03:38+01:00RemiHowToApacheFPMPHP<p>One of the benefits of FPM is a clear separation and isolation of web front-end (httpd) and from the application server (php-fpm).</p><p>Here is a simple configuration example using Apache as a load balancer to various FPM instances.</p><p> </p> <p>The base configuration is really (too) simple</p><pre> # Load balancer creation
<Proxy balancer://phpfpmlb>
BalancerMember fcgi://10.0.0.12:9000
BalancerMember fcgi://10.0.0.34:9000
</Proxy>
# Redirect PHP execution to the balancer
<FilesMatch \.php$>
SetHandler "proxy:balancer://phpfpmlb"
</FilesMatch></pre><p>For more information, read the documentation:</p><ul><li><a href="http://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html">mod_proxy_balancer</a></li><li><a href="http://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html">mod_proxy_fcgi</a></li></ul><p> </p>Apache HTTP Server et répartiteur de charge vers PHP FPMurn:md5:0b43d6f4610b0be668e3e966a00156922015-09-17T14:29:00+02:002016-12-05T13:03:38+01:00RemiHowToApacheFPMPHPplanetlibreplanetphpfr<p>L'un des avantages de FPM et de séparer et d'isoler proprement le frontal web du serveur d'application.</p><p>Voici un exemple de configuration utilisant Apache en répartiteur de charge entre plusieurs instances FPM.</p><p> </p> <p>La configuration de base est vraiment (trop) simple</p><pre> # Creation du repartiteur et de ces membres
<Proxy balancer://phpfpmlb>
BalancerMember fcgi://10.0.0.12:9000
BalancerMember fcgi://10.0.0.34:9000
</Proxy>
# Redirection de l'execution PHP vers le repartiteur
<FilesMatch \.php$>
SetHandler "proxy:balancer://phpfpmlb"
</FilesMatch></pre><p>Pour aller plus loin, voir la documentation :</p><ul><li><a href="http://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html">mod_proxy_balancer</a></li><li><a href="http://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html">mod_proxy_fcgi</a></li></ul><p> </p>PHP-FPM in Dockerurn:md5:36429c96c32209fe77f5f4b5679985992014-12-11T14:31:00+01:002016-12-05T13:03:38+01:00RemiHowToDockerFPMPHPplanet-php<p><strong>Use case</strong> : running <strong>php 5.3.3</strong> on a <strong>Fedora 20</strong> / 21 development workstation, for production deployment on <strong>RHEL-6</strong> (as no php 5.3 SCL exists).</p> <p>This example can be easily adapted for all available PHP versions available as RPM (<strong>5.3.3</strong> in RHEL-6, <strong>5.4.16</strong> in RHEL-7, 5.4.16 and <strong>5.5.6</strong> in RHSCL 1.2 or using a third party repository).</p>
<p>I use this <strong>Dockerfile</strong>:</p>
<blockquote>
<pre>FROM centos:6<br />RUN yum -y update && yum clean all<br />RUN yum -y install php-fpm php-mbstring php-mysql php-gd && yum clean all<br />RUN sed -e 's/127.0.0.1:9000/9000/' \<br /> -e '/allowed_clients/d' \<br /> -e '/catch_workers_output/s/^;//' \<br /> -e '/error_log/d' \<br /> -i /etc/php-fpm.d/www.conf<br />RUN mkdir -p /var/www/html<br />EXPOSE 9000<br />ENTRYPOINT /usr/sbin/php-fpm --nodaemonize</pre></blockquote>
<p><strong>Installation:</strong></p>
<ul><li>yum install allow to use the available packages, extension list need to be adapted to suite your need</li>
</ul>
<strong>Scripts directory:</strong><br /><ul><li>the /var/www/html directory used here need to be adapted, according to your scripts location</li>
</ul>
<p><strong>Changes applied to the fpm pool configuration:</strong></p>
<ul><li><strong>listen</strong> = 9000 to listen on all interfaces</li>
<li>remove <strong>listen.allowed_clients</strong> to allow connection from outside the container</li>
<li>remove <strong>error_log</strong> to use global error recording</li>
<li>enable<strong> catch_workers_ouput </strong>to catch the pool error in the main server</li>
</ul>
<p><strong>Creation of the container:</strong></p>
<pre>docker build -t fpm53 .</pre><p><strong>Launching the container:</strong></p>
<pre>docker run -v /var/www/html:/var/www/html -p 127.0.0.1:9003:9000 fpm53</pre><p>Notice : /var/www/html directory and port 9000 (in container) mapped to port 9003 (in host) </p>
<p><strong>Conclusion</strong></p>
<p>Even if I'm a fervent supporter of <a href="https://blog.remirepo.net/tag/SCL">Software Collections</a>, when missing, we have a very simple way to get an operational PHP version 5.3.3 on a recent distribution (tested on Fedora 20) with the benefit of using official repository.</p>PHP-FPM dans Dockerurn:md5:e3f453088a99686eca9cdba2aa88fd802014-12-11T14:23:00+01:002016-12-05T13:03:38+01:00RemiHowToDockerFPMPHPplanetlibreplanetphpfrSoftware Collections<p><strong>Cas d'utilisation</strong> : faire tourner <strong>php 5.3.3</strong> sur une machine de développement en <strong>Fedora 20</strong> / 21, pour déploiement en production sur <strong>RHEL-6</strong> (et aucune SCL de php 5.3 n'est actuellement disponible).</p> <p>Cet exemple peut facilement s'adapter pour toutes les versions disponibles sous forme de RPM (<strong>5.3.3</strong> dans RHEL-6, <strong>5.4.16</strong> dans RHEL-7, 5.4.16 et <strong>5.5.6</strong> dans RHSCL 1.2 ou en utilisant un dépôt tiers).</p>
<p>J'utilise le <strong>Dockerfile</strong> suivant :</p>
<blockquote>
<pre>FROM centos:6<br />RUN yum -y update && yum clean all<br />RUN yum -y install php-fpm php-mbstring php-mysql php-gd && yum clean all<br />RUN sed -e 's/127.0.0.1:9000/9000/' \<br /> -e '/allowed_clients/d' \<br /> -e '/catch_workers_output/s/^;//' \<br /> -e '/error_log/d' \<br /> -i /etc/php-fpm.d/www.conf<br />RUN mkdir -p /var/www/html<br />EXPOSE 9000<br />ENTRYPOINT /usr/sbin/php-fpm --nodaemonize</pre></blockquote>
<p><strong>Installation :</strong></p>
<ul><li>yum install permet de récupérer les paquets binaires disponibles, la liste des extensions est à adapter aux besoins</li>
</ul>
<strong>Dossier des scripts :</strong><br /><ul><li>le dossier /var/www/html utilisé dans l'exemple est à adapté en fonction de l'emplacement des applications</li>
</ul>
<p><strong>Description des changements de la configuration du pool fpm :</strong></p>
<ul><li><strong>listen</strong> = 9000 pour écouter sur toutes les interfaces</li>
<li>suppression de<strong> listen.allowed_clients</strong> pour autoriser les connexions depuis l'extérieur du container</li>
<li>suppression de l'<strong>error_log</strong> pour utiliser la journalisation globale</li>
<li>activation de<strong> catch_workers_ouput </strong>pour que le server principal récupère et trace les erreurs des pools</li>
</ul>
<p><strong>Création du container :</strong></p>
<pre>docker build -t fpm53 .</pre><p><strong>Lancement du container :</strong></p>
<pre>docker run -v /var/www/html:/var/www/html -p 127.0.0.1:9003:9000 fpm53</pre><p>A noter : mappage du dossier /var/www/html et du port 9000 (du container) sur le port 9003 (de l'hote) </p>
<p><strong>Conclusion :<br /></strong></p>
<p>Même si je suis un fervent adepte des <a href="https://blog.remirepo.net/tag/SCL">Software Collections</a>, en leur absence, on dispose très simplement d'une version opérationnelle de PHP 5.3.3 sur une distribution récente (testé sous Fedora 20) en bénéficiant de l'utilisation des dépôts officiels.</p>Apache httpd server 2.4.10 and PHP-FPM 5.6 in Fedora 21urn:md5:d0983addd3e070ef6156459ac280c0652014-08-01T21:31:00+02:002016-12-05T13:03:38+01:00RemiHowToApacheFPMPHPplanet-php<p>Since the update in <strong>Fedora 21</strong> of <strong>httpd</strong> version <strong>2.4.10</strong> and <strong>php 5.6.0RC3</strong>, you can avoid using mod_php. php-fpm works "out of the box", with default provided configuration.</p> <p><strong>Installation</strong>:</p>
<pre># yum remove php<br /># yum install php-fpm httpd</pre><p><strong>Services:</strong></p>
<pre># systemctl start php-fpm.service<br /># systemctl start httpd.service</pre><p><strong>Test</strong></p>
<pre># echo '<?php phpinfo()' >/var/www/html/info.php</pre><p>URL: <a href="http://localhost/info.php">http://localhost/info.php</a></p>
<p>You should see the message : <strong>Server API: FPM/FastCGI </strong></p>
<p><strong>Configuration</strong></p>
<p>The default provided configuration now work in Fedora 21.</p>
<p>You can use the same in Fedora 19 and 20, applying some change to your PHP configuration file /etc/httpd/conf.d/php.conf</p>
<p>Disable the php_* directives, when mod_php is not loaded:</p>
<pre># mod_php options<br /><IfModule mod_php5.c><br /> ...<br /> php_value session.save_handler "files"<br /> php_value session.save_path "/var/lib/php/session"<br /> php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache"<br /></IfModule></pre><p>Enable redirect the execution of php scripts to php-fpm service:</p>
<pre># Redirect to local php-fpm if mod_php is not available<br /><IfModule !mod_php5.c><br /> <FilesMatch \.php$><br /> SetHandler "proxy:fcgi://127.0.0.1:9000"<br /> </FilesMatch><br /></IfModule></pre><p><strong>Apache httpd server optimisation<br /></strong></p>
<p>Time to leave the <em>prefork</em> MPM in /etc/httpd/conf.modules.d/00-mpm.conf</p>
<pre>LoadModule mpm_event_module modules/mod_mpm_event.so</pre>
<p><strong>For packagers<br /></strong></p>
<p><strong>php-fpm</strong> only pull <strong>httpd-filesystem</strong>, for user creation and configuration directory ownership and can still be used without httpd, for example with <strong>nginx</strong>. Despite I still think than Apache httpd server still the best server to package web applications, mostly as it allows to drop a configuration file, per application, with global <strong>alias</strong>.</p>
<p>I encourage you to test your applications with this configuration, especially to ensure than all php_* directives are properly conditionalized..</p>
<p>Next step will be to drop the dependency on <strong>mod_php</strong> and give back the choice to our users.</p>
<p><strong>Conclusion</strong></p>
<p>This feature finally drop the difficulty to use PHP-FPM and other Apache MPM. A pity that it is not available in httpd version provided by RHEL/CentOS-7 or by RHSCL 1.1.</p>Apache httpd server 2.4.10 et PHP-FPM 5.6 dans Fedora 21urn:md5:9e3b7c0541afba268853d2321dd0b5812014-08-01T20:57:00+02:002016-12-05T13:03:38+01:00RemiHowToApacheFPMPHPplanetlibre<p>Depuis la mise à jour dans <strong>Fedora 21</strong> d'<strong>httpd</strong> version <strong>2.4.10</strong> et de <strong>php 5.6.0RC3</strong>, il est désormais possible de se passer de mod_php. php-fpm fonctionne désormais avec la configuration par défaut fournie.</p> <p><strong>Installation</strong> :</p>
<pre># yum remove php<br /># yum install php-fpm httpd</pre><p><strong>Démarrage des services</strong></p>
<pre># systemctl start php-fpm.service<br /># systemctl start httpd.service</pre><p><strong>Test</strong></p>
<pre># echo '<?php phpinfo()' >/var/www/html/info.php</pre><p>URL: <a href="http://localhost/info.php">http://localhost/info.php</a></p>
<p>Vous devez voir le message : <strong>Server API: FPM/FastCGI </strong></p>
<p><strong>Configuration</strong></p>
<p>La configuration fournie par défaut fonctionne donc désormais sans modification sous Fedora 21.</p>
<p>Il est possible de l'utiliser en Fedora 19 et 20 en appliquant les modifications au fichier de configuration de PHP /etc/httpd/conf.d/php.conf</p>
<p>Désactiver les directives php_* si mod_php n'est pas chargé</p>
<pre># mod_php options<br /><IfModule mod_php5.c><br /> ...<br /> php_value session.save_handler "files"<br /> php_value session.save_path "/var/lib/php/session"<br /> php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache"<br /></IfModule></pre><p>Activer la redirection vers le serveur php-fpm</p>
<pre># Redirect to local php-fpm if mod_php is not available<br /><IfModule !mod_php5.c><br /> <FilesMatch \.php$><br /> SetHandler "proxy:fcgi://127.0.0.1:9000"<br /> </FilesMatch><br /></IfModule></pre><p><strong>Optimisation du serveur Apache</strong></p>
<p>C'est l'occasion d'abandonner le MPM <em>prefork</em> dans /etc/httpd/conf.modules.d/00-mpm.conf</p>
<pre>LoadModule mpm_event_module modules/mod_mpm_event.so</pre>
<p><strong>Pour les packageurs</strong></p>
<p><strong>php-fpm</strong> tire <strong>httpd-filesystem</strong>, uniquement pour la création de l'utilisateur apache et des dossiers de configuration, mais reste utilisable sans httpd, par exemple avec <strong>nginx</strong>. Cependant Apache httpd server reste, pour moi, le seul server adapté pour les applications web, en particulier parce qu'il permet de fournir un fichier de configuration par application contenant des <strong>alias</strong> globaux.</p>
<p>Je vous encourage à tester vos applications dans cette configuration, en particulier à mettre des conditions autour des directives<strong> php_*</strong> dans leur fichier de configuration.</p>
<p>La prochaine étape sera de supprimer la dépendance sur <strong>mod_php</strong> pour laisser le choix aux utilisateurs.</p>
<p><strong>Conclusion</strong></p>
<p>Cette fonctionnalité supprime enfin la difficulté d'utiliser PHP-FPM et les autres MPM d'apache. Dommage qu'elle ne soit pas disponible dans la version d'httpd fournie avec RHEL/CentOS-7 ou dans RHSCL 1.1.</p>PHP-FPM and HTTPD 2.4 improvementurn:md5:7a1e5c4de253642859ed02721d0033422014-03-28T13:52:00+01:002016-12-05T13:03:38+01:00RemiHowToApacheFPMPHPplanet-php<p>Addition to the previous article: <a href="https://blog.remirepo.net/post/2012/04/02/PHP-FPM-and-HTTPD-2.4">PHP-FPM and HTTPD 2.4</a></p>
<p>Until now, we have to use the <a href="http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassmatch">ProxyPassMatch</a> directive, not very flexible, here is very simpler solution.</p> <p><a href="http://www.apache.org/dist/httpd/Announcement2.4.html">Apache HTTP Server 2.4.9</a> was recently released and will be soon available in <a href="https://admin.fedoraproject.org/updates/httpd-2.4.9-2.fc20">Fedora 20</a> updates.</p>
<p>This version integrates an upstream fix (not yet applied in the official release) to redirect requests to a FastCGI proxy using the <a href="http://httpd.apache.org/docs/2.4/mod/core.html#sethandler">SetHandler</a> directive.</p>
<p>As the <strong>ProxyPassMatch</strong> directive is evaluated as the very beginning of each request:</p>
<ul><li><a href="http://httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype">AddType</a> (for MultiView) or <a href="http://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex">DirectoryIndex</a> directives are not usable</li>
<li>right management per directory is not available</li>
<li>each <a href="http://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias">Alias</a> directive needs another proxy rule</li>
</ul>
<p>The<strong> SetHandler</strong> directive, evaluated later, is much more flexible / usable. It is used (recommended) for <strong>mod_php</strong></p>
<pre><FilesMatch \.phps$><br /> SetHandler application/x-httpd-php-source<br /></FilesMatch></pre><p>Thanks to this improvement, using <strong>php-fpm</strong> is, now, as simple as <strong>mod_php</strong>.</p>
<p>To redirect the PHP scripts to the FPM server:</p>
<pre><FilesMatch \.php$><br /> SetHandler "proxy:fcgi://127.0.0.1:9000"<br /></FilesMatch></pre><p>Warning: if you remove or disable<strong> mod_php</strong>, you also need to remove all the <strong>php_value</strong> and <strong>php-flag</strong> directives, for example, making them conditional:</p>
<pre><IfModule mod_php5.c><br /> php_value session.save_handler "files"<br /> php_value session.save_path "/var/lib/php/session"<br /> php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache"<br /></IfModule></pre><p>By the way, we can also take advantage of dropping mod_php to switch from the <em>prefork</em> MPM to a threaded one:</p>
<pre>#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so<br />LoadModule mpm_event_module modules/mod_mpm_event.so</pre><p>Then, most of the web applications work as usually, except those using http authentication, which is not (yet) supported by FPM.</p>
<p>To be followed: switch to <a href="http://en.wikipedia.org/wiki/Unix_domain_socket">Unix Domain Sockets</a> announced with 2.4.9 but which works only partially (fix are under review).</p>Amélioration de PHP-FPM et HTTPD 2.4urn:md5:9181dd57f890bfcc58aaf37687b73c352014-03-28T13:34:00+01:002016-12-05T13:03:38+01:00RemiHowToApacheFPMPHPplanetlibre<p>Suite du billet <a href="https://blog.remirepo.net/post/2012/04/02/PHP-FPM-et-HTTPD-2.4">PHP-FPM et HTTPD 2.4</a></p>
<p>Jusqu'à présent, on devait passer par la directive <a href="http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassmatch">ProxyPassMatch</a>, pas très souple, voici comment faire plus simple.</p> <p>La version <a href="http://www.apache.org/dist/httpd/Announcement2.4.html">Apache HTTP Server 2.4.9</a> récemment publiée sera bientôt disponible dans les mises à jour de <a href="https://admin.fedoraproject.org/updates/httpd-2.4.9-2.fc20">Fedora 20</a>.</p>
<p>Cette version intègre un correctif (pas encore appliqué dans la version officielle) qui permet de rediriger les requêtes vers un mandataire FastCGI à l'aide de la directive <a href="http://httpd.apache.org/docs/2.4/mod/core.html#sethandler">SetHandler</a>.</p>
<p>La directive <strong>ProxyPassMatch</strong> étant évaluée au tout début d'une requête</p>
<ul><li>les directives <a href="http://httpd.apache.org/docs/2.4/mod/mod_mime.html#addtype">AddType</a> (pour le MultiView) ou <a href="http://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex">DirectoryIndex</a> ne sont pas utilisables</li>
<li>la gestion des <strong>droits</strong> par dossier n'est pas prise en compte</li>
<li>chaque <a href="http://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias">Alias</a> doit être complété d'une règle de proxy</li>
</ul>
<p>La directive <strong>SetHandler</strong> qui est évaluée à la fin est donc beaucoup plus pratique, elle est d'ailleurs utilisée pour <strong>mod_php</strong></p>
<pre><FilesMatch \.phps$><br /> SetHandler application/x-httpd-php-source<br /></FilesMatch></pre><p>Grâce à cette évolution on va pouvoir utiliser <strong>php-fpm</strong> aussi simplement que <strong>mod_php</strong>.</p>
<p>Pour rediriger les scripts PHP vers le serveur FPM:</p>
<pre><FilesMatch \.php$><br /> SetHandler "proxy:fcgi://127.0.0.1:9000"<br /></FilesMatch></pre><p>Attention, si vous désinstallez ou désactivez<strong> mod_php</strong> vous devez aussi supprimer toutes les directives <strong>php_value</strong> et <strong>php-flag</strong>, par exemple en les rendant conditionnelles :</p>
<pre><IfModule mod_php5.c><br /> php_value session.save_handler "files"<br /> php_value session.save_path "/var/lib/php/session"<br /> php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache"<br /></IfModule></pre><p>Au passage, on peut en profiter pour abandonner le MPM <em>prefork</em> au profit d'un mode utilisant les <em>threads</em> :</p>
<pre>#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so<br />LoadModule mpm_event_module modules/mod_mpm_event.so</pre><p>Ensuite, les applications web en PHP fonctionnent normalement (sauf celle utilisant l'authentification http, qui n'est pas encore supportée par FPM).</p>
<p>A suivre : l'utilisation des <a href="http://fr.wikipedia.org/wiki/Sockets_du_domaine_UNIX#Socket_unix">Sockets du domaine Unix</a>, annoncé pour la 2.4.9 mais ne fonctionne que partiellement (les correctifs sont en cours de revue).</p>Various PHP versions with an Apache 2.4 serverurn:md5:d60b45f03fd3866bfafe7a5a656888702013-11-07T15:38:00+01:002014-06-04T08:43:16+02:00RemiRPMApacheFPMPHPplanet-phpSCL<p>For my talk about <a href="https://blog.remirepo.net/post/2013/10/05/Software-Collections-Introduction">Software Collections Introduction</a> I done a demonstration on using a single Apache web server running simultaneously 3 PHP versions (5.3, 5.4 et 5.5).</p>
<p>Here is an how to implement this on RHEL 6 or CentOS 6.</p>
<p>Of course this configuration can be used on all distributions, if you can install various versions of the same application, or if you know how to build from sources. It's just easier with SCL.</p> <p>Of course, I use the available SCL pakages from the <a href="https://fedorahosted.org/SoftwareCollections/">SoftwareCollections</a> project site, especially the <strong>httpd24</strong>, <strong>php54</strong> and <strong>php55</strong> collections.</p>
<p>RHSCL 1.0 repository configuration for RHEL-6 (<strong>php54</strong>):</p>
<pre>rhn-channel --add --channel=rhel-x86_64-server-6-rhscl-1</pre>
<p><strong>php54</strong> repository configuration on CentOS-6 as RHSCL-1.0 is not (yet ?) backported:</p>
<pre>wget http://people.redhat.com/rcollet/php54/rhel-php54.repo -O /etc/yum.repos.d/php54.repo</pre><p><strong>httpd24</strong> repository configuration: </p>
<pre>wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo -O /etc/yum.repos.d/httpd24.repo</pre><p><strong>php55</strong> repository configuration :</p>
<pre>wget http://people.redhat.com/rcollet/php55/rhel-php55.repo -O /etc/yum.repos.d/php55.repo</pre><p>Apache 2.4.6, PHP 5.3.3, 5.4.16 and 5.5.5 packages installation:</p>
<pre>yum install httpd24 php54 php54-php-fpm php55 php55-fpm php-fpm</pre><p>As the 3 php-fpm versions are configured to listen on the same port I have to change this:</p>
<pre>sed -e 's/9000/9002/' -i /opt/rh/php54/root/etc/php-fpm.d/www.conf<br />semanage port -a -t http_port_t -p tcp 9002<br /><br />sed -e 's/9000/9003/' -i /opt/rh/php55/root/etc/php-fpm.d/www.conf<br />semanage port -a -t http_port_t -p tcp 9003</pre><p><strong>Apache configuration</strong> for delegating the PHP scripts execution to a php-fpm back-end, according to the version, The new /opt/rh/root/etc/httpd/conf.d/fpm.conf file:</p>
<pre># PHP script executed by FPM backend<br />ProxyPassMatch ^/php53/(.*\.php)$ fcgi://127.0.0.1:9000/srv/website<br /># Other static stuff<br />Alias /php53 /srv/website<br /><br />ProxyPassMatch ^/php54/(.*\.php)$ fcgi://127.0.0.1:9002/srv/website<br />Alias /php54 /srv/website<br /><br />ProxyPassMatch ^/php55/(.*\.php)$ fcgi://127.0.0.1:9003/srv/website<br />Alias /php55 /srv/website</pre><p>I choose to configure the 3 URL to serve the same folder as my goal is to test the same applilcation with various PHP versions.</p>
<p>I could also have configured various virtual hosts.</p>
<p>Prefered web application installation:</p>
<pre>mkdir /srv/website<br />echo '<?php phpinfo()' >/srv/website/info.php</pre><p>Required services start up:</p>
<pre>service httpd24-httpd start<br />service php-fpm start<br />service php54-php-fpm start<br />service php55-php-fpm start</pre><p>Just enjoy: <a href="http://localhost/php53/info.php">http://localhost/php53/info.php</a> or <a href="http://localhost/php54/info.php">http://localhost/php54/info.php</a> or <a href="http://localhost/php53/info.php">http://localhost/php55/info.php</a></p>
<p>Notice: this is a very simple configuration, for development/testing purpose. It will requiring more tunning to be used in production, but it's working.</p>Plusieurs versions de PHP sur un serveur Apache 2.4urn:md5:824ceb206c7367a00e6e4062082e20182013-11-07T15:15:00+01:002016-12-05T13:03:38+01:00RemiHowToApacheFPMPHPplanetlibreSCL<p>Pour illustrer ma conférence <a href="https://blog.remirepo.net/post/2013/10/05/Introduction-aux-Software-Collections">Introduction aux Software Collections</a>, j'ai fait la démonstration sur l'utilisation d'un frontal Apache fonctionnant simultanément avec 3 versions de PHP (5.3, 5.4 et 5.5).</p>
<p>Gros plan sur cette mise en oeuvre très simple sur RHEL 6 ou CentOS 6.</p>
<p>Bien sur cette configuration peut s'appliquer à toutes les distributions, à condition de pouvoir installer plusieurs versions en parallèle ou de savoir compiler les sources. C'est juste plus facile avec les SCL.</p> <p>J'ai évidement utiliser les paquets disponibles en SCL sur le site du projet <a href="https://fedorahosted.org/SoftwareCollections/">SoftwareCollections</a>, en particulier les collections <strong>httpd24</strong>, <strong>php54</strong> et <strong>php55</strong>.</p>
<p>Installation du dépôt RHSCL 1.0 sur RHEL-6 (pour <strong>php54</strong>)</p>
<pre>rhn-channel --add --channel=rhel-x86_64-server-6-rhscl-1</pre>
<p>Installation du dépôt <strong>php54</strong> sur CentOS-6</p>
<pre>wget http://people.redhat.com/rcollet/php54/rhel-php54.repo -O /etc/yum.repos.d/php54.repo</pre><p>Installation du dépôt <strong>httpd24</strong> :</p>
<pre>wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo -O /etc/yum.repos.d/httpd24.repo</pre><p>Installation du dépôt <strong>php55</strong> :</p>
<pre>wget http://people.redhat.com/rcollet/php55/rhel-php55.repo -O /etc/yum.repos.d/php55.repo</pre><p>Installation des paquets Apache 2.4.6, PHP 5.3.3, 5.4.16 et 5.5.5 :</p>
<pre>yum install httpd24 php54 php54-php-fpm php55 php55-fpm php-fpm</pre><p>Comme les 3 versions de php-fpm sont configurées pour écouter sur le port 9000, modifions cela :</p>
<pre>sed -e 's/9000/9002/' -i /opt/rh/php54/root/etc/php-fpm.d/www.conf<br />semanage port -a -t http_port_t -p tcp 9002<br /><br />sed -e 's/9000/9003/' -i /opt/rh/php55/root/etc/php-fpm.d/www.conf<br />semanage port -a -t http_port_t -p tcp 9003</pre><p><strong>Configuration d'apache</strong> pour qu'il demande l'exécution des scripts PHP à FPM en fonction de la version, en créant le fichier /opt/rh/root/etc/httpd/conf.d/fpm.conf</p>
<pre># PHP script executed by FPM backend<br />ProxyPassMatch ^/php53/(.*\.php)$ fcgi://127.0.0.1:9000/srv/website<br /># Other static stuff<br />Alias /php53 /srv/website<br /><br />ProxyPassMatch ^/php54/(.*\.php)$ fcgi://127.0.0.1:9002/srv/website<br />Alias /php54 /srv/website<br /><br />ProxyPassMatch ^/php55/(.*\.php)$ fcgi://127.0.0.1:9003/srv/website<br />Alias /php55 /srv/website</pre><p>J'ai choisi de rediger les 3 URL vers le même dossier, car mon objectif est de tester la même application avec les différentes versions de PHP.</p>
<p>J'aurais aussi pu configurer 3 hôtes virtuels.</p>
<p>Installons notre application préférée:</p>
<pre>mkdir /srv/website<br />echo '<?php phpinfo()' >/srv/website/info.php</pre><p>Démarrage des services</p>
<pre>service httpd24-httpd start<br />service php-fpm start<br />service php54-php-fpm start<br />service php55-php-fpm start</pre><p>Il ne reste plus qu'à profiter : <a href="http://localhost/php53/info.php">http://localhost/php53/info.php</a> ou <a href="http://localhost/php54/info.php">http://localhost/php54/info.php</a> ou <a href="http://localhost/php53/info.php">http://localhost/php55/info.php</a></p>
<p>A noter, il s'agit d'une configuration simpliste, destinée a un développeur désirant faire des tests. Elle nécessiterait d'être améliorée pour une utilisation en production, mais le principe reste le même.</p>PHP-FPM and systemdurn:md5:f4bac7fa0e3b5e5df875de5854467d752013-06-06T16:13:00+02:002016-12-05T13:03:38+01:00RemiHowToContributeurFPMPHPsystemd<p>Those who are used to read the <a href="http://www.php.net/ChangeLog-5.php">release notes</a> have probably noticed a new feature :</p>
<pre>- FPM:<br /> . Add --with-fpm-systemd option to report health to systemd, and<br /> systemd_interval option to configure this. The service can now use<br /> Type=notify in the systemd unit file. (Remi)</pre> <p>Of course, this new feature is enabled in the RPM of <strong><a href="https://blog.remirepo.net/post/2013/06/07/php-5.4.16-en">PHP 5.4.16</a></strong> in Fedora 18 and <strong><a href="https://blog.remirepo.net/post/2013/03/21/PHP-5.5.0-in-preparation">PHP 5.5.0RC3</a> </strong>in Fedora 19, and the ones in my repository (fedora >= 16).</p>
<p>In the service description (unit) file, we now have the line :</p>
<pre>Type=notify</pre><p>This means that <strong>systemd</strong> will receive start status and health information send by the main <em>php-fpm</em> process. The delay between refresh can be configured using the <em>systemd_interval</em> option (in /etc/php-fpm.conf), default is 10" (0 to disable).</p>
<p>After the start-up, the "Status" line is:</p>
<pre> Status: "Ready to handle connections"</pre><p>Then it is refreshed and provides information about the service's health:</p>
<pre> Status: "Processes active: 0, idle: 5, Requests: 101, slow: 2, Traffic: 6.2req/sec"</pre><p>Which are, the number of active / available processes, the number of requests and slow requests since the service start-up, and the average traffic (requests by sec) since the last update.</p>
<p>I also fix a bug discovered buring my tests:</p>
<pre>- FPM:<br /> . Fixed Bug #64915 (error_log ignored when daemonize=0). (Remi)</pre><p>Before this fix, whatever the value of <em>error_log</em> option, all the messages from<strong> php-fpm</strong> were saved in the system log instead of the configured file (/var/log/php-fpm/error.log). Of course, it is possible to use the system log, need to be explicitly set:</p>
<pre>error_log = syslog</pre>
<p>Another feature available with this systemd integration is the <a hreflang="en" href="http://0pointer.de/blog/projects/watchdog.html">Watchdog</a> mode of systemd.</p>
<p>The service configuration must be changed, by editing a copy of the unit file in /etc:</p>
<pre>cp /lib/systemd/system/php-fpm.service /etc/systemd/system/php-fpm.service </pre>
<p>Starting with <strong> Fedora 19 </strong>it is also possible to simply add a /etc/systemd/system/php-fpm.service.d/watchdog.conf file.</p>
<p>With, at least the option:</p>
<pre>[service]<br />WatchdogSec=30</pre>
<p>In the configuration, the value of <em>systemd_interval</em> option is ignored, and half of systemd configured value is used instead.</p>
<p>Here is a good way to monitor a service and have systemd run the necessary action (service restart, for example).</p>
<p>Is there someone who still prefer old SysV scripts ?</p>PHP-FPM et systemdurn:md5:ed89d17e8d88390e609ca5b4b9653db22013-06-06T15:36:00+02:002016-12-05T13:03:38+01:00RemiHowToContributeurFPMPHPplanetlibresystemd<p>Ceux qui lisent les <a href="http://www.php.net/ChangeLog-5.php">notes de versions</a> auront peut-être remarqué la nouveauté :</p>
<pre>- FPM:<br /> . Add --with-fpm-systemd option to report health to systemd, and<br /> systemd_interval option to configure this. The service can now use<br /> Type=notify in the systemd unit file. (Remi)</pre> <p>Bien évidement cette option est appliquée sur les RPM <a href="https://blog.remirepo.net/post/2013/06/07/php-5.4.16"><strong>PHP 5.4.16</strong></a> de Fedora 18 et <a href="https://blog.remirepo.net/post/2013/03/21/PHP-5.5.0-en-preparation"><strong>PHP 5.5.0RC3</strong></a> de Fedora 19, ainsi que ceux de mon dépôt (fedora >= 16).</p>
<p>Dans le fichier de description du service on trouve donc désormais la ligne</p>
<pre>Type=notify</pre><p>Ce qui signifie que <strong>systemd</strong> recevra la confirmation du démarrage, et périodiquement une information de santé, envoyées par le processus principal de <em>php-fpm</em>. L'intervalle peut-être réglé à l'aide de l'option <em>systemd_interval</em> (dans /etc/php-fpm.conf), réglé par défaut à 10" (0 pour désactiver).</p>
<p>Lors du lancement, la ligne "Status" contient:</p>
<pre> Status: "Ready to handle connections"</pre><p>Ensuite cette ligne est actualisée et contient des informations utiles sur la santé du service :</p>
<pre> Status: "Processes active: 0, idle: 5, Requests: 101, slow: 2, Traffic: 6.2req/sec"</pre><p>C'est à dire, le nombre de processus actifs et disponibles, le nombre total de requêtes et de requêtes lentes depuis le démarrage du service, ainsi que le trafic depuis la dernière mise à jour.</p>
<p>J'en ai profité pour corrigé un bug découvert lors de mes tests :</p>
<pre>- FPM:<br /> . Fixed Bug #64915 (error_log ignored when daemonize=0). (Remi)</pre><p>Avant cette correction, quelque soit la valeur de l'option <em>error_log</em>, les messages émis par<strong> php-fpm</strong> étaient tracés dans le journal système au lieu du fichier indiqué (/var/log/php-fpm/error.log). Il est évidement possible d'utiliser le journal système en le précisant explicitement :</p>
<pre>error_log = syslog</pre>
<p>Une autre possibilité offerte par cette intégration est d'utiliser le mode <a hreflang="en" href="http://0pointer.de/blog/projects/watchdog.html">Watchdog</a> de systemd.</p>
<p>Pour cela, il faut modifier le fichier de description du service, en commençant par le copier dans /etc</p>
<pre>cp /lib/systemd/system/php-fpm.service /etc/systemd/system/php-fpm.service </pre>
<p>À partir de<strong> Fedora 19 </strong>on peut aussi, plus simplement, créer un fichier /etc/systemd/system/php-fpm.service.d/watchdog.conf</p>
<p>Ensuite on ajoutera au moins l'option </p>
<pre>[service]<br />WatchdogSec=30</pre>
<p>Dans ce cas la valeur <em>systemd_interval</em> est ignorée et remplacée par la moitié de celle demandée par systemd.</p>
<p>Voila une bonne manière de surveiller son service et de laisser systemd prendre les mesures nécessaires (relance automatique du service, par exemple).</p>
<p>Il y en a encore qui préfèrent les vieux scripts SysV ?</p>PHP-FPM and HTTPD 2.4urn:md5:dbccf4cae7c6705f65e1cf7fff0e1c132012-04-02T10:20:00+02:002016-12-05T13:03:38+01:00RemiHowToFPMhttpdPHP<p>The <a hreflang="en" href="http://www.php.net/manual/en/install.fpm.php">php-fpm</a> engine can now work with <a hreflang="en" href="http://httpd.apache.org/">httpd</a> <strong>2.4</strong> and the <a hreflang="en" href="http://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html">mod_proxy_fcgi</a> module, here is a small implementation example.</p> <p>My goal is to install a working web server, for local and packaged (RPM) applications, I will use <a hreflang="en" href="http://www.phpmyadmin.net/">phpMyAdmin</a> as an example.</p>
<p><strong>Apache version 2.4</strong> will not be available in the repository before <strong>Fedora 18 </strong>(and probably <strong>RHEL 7</strong>), but you can find a backport in my <a href="https://blog.remirepo.net/post/2012/03/28/F16-experimental-repository">Experimental repository for Fedora 16</a>.</p>
<h2>1. Installation</h2>
<pre>yum --enablerepo=remi-dev,remi install php-fpm httpd phpMyAdmin</pre><h2>2. Creating my web site</h2>
<p>With apache, scripts are installed, by default in /var/www/html, so</p>
<pre>echo '<h1>My WebApp</h1><?php phpinfo(); ?>' >/var/www/html/info.php</pre><h2>3. Disable mod_php</h2>
<p>If the php package is installed, the request will be handled by the integrated engine, so it must be disabled.</p>
<p>In the /etc/httpd/conf.d/php.conf file, just comment the line:</p>
<pre>#AddHandler php5-script .php</pre><p>The call of <a href="http://localhost/info.php">http://localhost/info.php</a> should only display the title (My WebApp).</p>
<h2>4. Configure the proxy</h2>
<p>We ask apache to redirect the PHP scripts to the php-fpm service, by adding in the php.conf file:</p>
<pre>ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1</pre>
<p>After a apache restart, you should get the 503 message "<em>Service Temporarily Unavailable</em>", and in the error log:</p>
<pre>[proxy:error] [pid 7960] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (*) failed<br />[proxy_fcgi:error] [pid 7960] [client ::1:40505] AH01079: failed to make connection to backend: 127.0.0.1, referer: http://localhost/</pre><p>This is normal, after we start the <strong>php-fpm</strong> service, we get the expected phpinfo information.</p>
<h2>5. Configure the proxy for phpMyAdmin</h2>
<p>We add a new configuration line to redirect the PHP scripts provided by phpMyAdmin (before previous general configuration), this replace the usual <a href="http://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias">alias</a> directive.</p>
<pre>ProxyPassMatch ^/phpMyAdmin/(.*\.php)$ fcgi://127.0.0.1:9000/usr/share/phpMyAdmin/$1</pre><p>We also add a line for the folder only URL, replacing the <a href="http://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex">DirectoryIndex</a> directive:</p>
<pre>ProxyPassMatch ^/phpMyAdmin(.*/)$ fcgi://127.0.0.1:9000/usr/share/phpMyAdmin$1index.php</pre><p>After another apache restart, the URL <a href="http://localhost/phpMyAdmin/">http://localhost/phpMyAdmin/</a> should work as expected.</p>
<h2>6. Conclusion</h2>
<p>In this configuration, we can take full benefit of apache to handled the static items, by using the <a href="http://httpd.apache.org/docs/2.4/mod/worker.html">MPM worker</a> or the <a href="http://httpd.apache.org/docs/2.4/mod/event.html">MPM event</a>, for example, and delegated the PHP scripts execution to a dedicated service, which can even be installed on anotger server, like for some other langages.</p>
<p>You can post your comments, benchmark results, or other configuration examples, I'm not sure this is really the better solution.</p>
<p>See also:</p>
<ul>
<li><a href="https://blog.remirepo.net/post/2010/09/28/PHP-FPM-and-LIGHTTPD">PHP-FPM and LIGHTTPD</a></li>
<li><a href="https://blog.remirepo.net/post/2010/09/27/PHP-FPM-et-NGINX">PHP-FPM and NGINX</a></li>
</ul>PHP-FPM et HTTPD 2.4urn:md5:d1e000572317d048b6df296e728b5a8d2012-04-02T09:39:00+02:002016-12-05T13:03:38+01:00RemiHowToFPMhttpdPHP<p>Le moteur<a hreflang="fr" href="http://fr2.php.net/manual/fr/install.fpm.php"> php-fpm</a> peut désormais fonctionner avec <a hreflang="en" href="http://httpd.apache.org/">httpd</a> <strong>2.4</strong> et le module <a hreflang="en" href="http://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html">mod_proxy_fcgi</a>, voici un petit exemple de mise en oeuvre.</p> <p>L'objectif est de faire fonctionner un serveur Web pour des
applications locales et pour des applications livrées en RPM, je
prendrais <a hreflang="en" href="http://www.phpmyadmin.net/">phpMyAdmin</a> comme exemple.</p>
<p><strong>Apache version 2.4</strong> ne sera pas dans les dépôts avant <strong>Fedora 18 </strong>(et sans doute <strong>RHEL 7</strong>), mais mon <a href="https://blog.remirepo.net/post/2012/03/28/Depot-experimental-F16">dépôt expérimental</a> fournit un rétro-portage de ces paquets pour Fedora 16.</p>
<h2>1. Installation</h2>
<pre>yum --enablerepo=remi-dev,remi install php-fpm httpd phpMyAdmin</pre><h2>2. Creation de mon site web</h2>
<p>Avec apache, les pages sont installées par défaut dans /var/www/html, donc</p>
<pre>echo '<h1>Mon appli</h1><?php phpinfo(); ?>' >/var/www/html/info.php</pre><h2>3. Désactiver mod_php</h2>
<p>Si le paquet php est installé, la requete sera traitée par le moteur intégré, qu'il faut donc désactiver.</p>
<p>Dans le fichier /etc/httpd/conf.d/php.conf commenter la ligne</p>
<pre>#AddHandler php5-script .php</pre><p>L'appel de <a href="http://localhost/info.php">http://localhost/info.php</a> doit donc juste afficher le titre (Mon Appli).</p>
<h2>4. Configurer le proxy</h2>
<p>On va demander à apache de rediriger les scripts PHP vers le service php-fpm, en ajoutant dans le php.conf</p>
<pre>ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1</pre>
<p>Après un redémarrage d'apache on doit obtenir le message 503 "<em>Service Temporarily Unavailable</em>", ainsi, que dans le journal :</p>
<pre>[proxy:error] [pid 7960] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (*) failed<br />[proxy_fcgi:error] [pid 7960] [client ::1:40505] AH01079: failed to make connection to backend: 127.0.0.1, referer: http://localhost/</pre><p>Ce qui est normal, après un démarrage de <strong>php-fpm</strong>, on obtient le phpinfo attendu.</p>
<h2>5. Configurer le proxy pour phpMyAdmin</h2>
<p>On ajoutera une redirection pour les scripts PHP de phpMyAdmin (avant la configuration générale précédente), qui remplace l'<a href="http://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias">alias</a> définit habituellement.</p>
<pre>ProxyPassMatch ^/phpMyAdmin/(.*\.php)$ fcgi://127.0.0.1:9000/usr/share/phpMyAdmin/$1</pre><p>On ajoutera aussi le traitement des URL contenant uniquement un nom de dossier, afin de remplacer la directive <a href="http://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex">DirectoryIndex</a> :</p>
<pre>ProxyPassMatch ^/phpMyAdmin(.*/)$ fcgi://127.0.0.1:9000/usr/share/phpMyAdmin$1index.php</pre><p>Après relance d'apache, l'URL <a href="http://localhost/phpMyAdmin/">http://localhost/phpMyAdmin/</a> fonctionne comme attendue.</p>
<h2>6. Conclusion</h2>
<p>Dans cette configuration, on va pouvoir tirer pleinement profit d'apache pour les éléments statiques, par exemple en utilisant le <a href="http://httpd.apache.org/docs/2.4/mod/worker.html">MPM worker</a> ou le <a href="http://httpd.apache.org/docs/2.4/mod/event.html">MPM event</a> et confier l'exécution des scripts PHP à un service dédié, qui peut d'ailleurs être sur une autre machine, comme pour d'autres langages.</p>
<p>N'hésitez pas à poster vos commentaires, vos résultats de test de performance, ou d'autres solutions de configuration, je ne suis pas certain d'avoir réellement trouvé la meilleure solution.</p>
<p>Voir aussi :</p>
<ul><li><a href="https://blog.remirepo.net/post/2010/09/28/PHP-FPM-et-LIGHTTPD">PHP-FPM et LIGHTTPD</a></li>
<li><a href="https://blog.remirepo.net/post/2010/09/27/PHP-FPM-et-NGINX">PHP-FPM et NGINX</a></li>
</ul>PHP-FPM and LIGHTTPDurn:md5:05149e654452cf79ab9a021740ac1cf92010-09-28T18:51:00+02:002016-12-05T13:03:38+01:00RemiHowToFPMlighttpdPHP<p>Since <a hreflang="en" href="https://blog.remirepo.net/post/2010/07/22/PHP-5.3.3-released">PHP 5.3.3</a>, the <a hreflang="en" href="http://php-fpm.org/">PHP-FPM</a> engine is bundled. The <strong>php-fpm</strong> package is available in <strong>remi</strong> repository and will be soon in <em>rawhide</em>.</p>
<p>This entry show how to use it with the <a href="http://www.lighttpd.net/">lighttpd</a> web server.</p> <p>My goal is to install a working web server, for local and packaged (RPM) applications, I will use <a hreflang="en" href="http://www.phpmyadmin.net/">phpMyAdmin</a> as an example.</p>
<h2>1. Installation :</h2>
<pre>yum --enablerepo=remi install php-fpm phpMyAdmin lighttpd-fastcgi</pre><p>This command will also install the <strong>apache</strong> web server, listening on port 80. I will not use it, but I will configure <strong>lighttpd</strong> to listen on port 81.</p>
<h2>2. Creating my web site</h2>
<p>With <strong>lighttpd</strong>, pages are, by default, installed in the /var/www/lighttpd directory.</p>
<p>My application will be very minimal:</p>
<pre>echo '<?php phpinfo(); ?>' >/var/www/lighttpd/lhinfo.php</pre>
<h2>3. Lighttp configuration</h2>
<p>I'm really not an expert on this web server, but, reading the <a hreflang="en" href="http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs">documentation</a> (quite good), I found a working solution:</p>
Edit the /etc/lighttpd/lighttpd.conf configuration file:<br /><p><strong>Port</strong> (uncomment and change the line) : </p>
<pre>server.port = 81</pre>
<p>Activation of the needed <strong>modules</strong> (uncomment the lines) :</p>
<pre>"mod_alias",<br />"mod_fastcgi",</pre>
<p><strong>Fastcgi</strong> module configuration (add the lines)</p>
<pre>fastcgi.server = ( ".php" =><br /> ((<br /> "host" => "127.0.0.1",<br /> "port" => 9000<br /> ))<br />)</pre>
<p><strong>Alias</strong> for <strong>phpMyAdmin</strong> configuration, create the /etc/lighttpd/conf.d/phpMyAdmin.conf file:</p>
<pre> alias.url += ( "/phpMyAdmin" => "/usr/share/phpMyAdmin/" )</pre>
<h2>4. Launch the services</h2>
<pre>service php-fpm start<br />service lighttpd start</pre>
<h2>5. URL de test</h2>
<ul>
<li><a href="http://localhost:81/">http://localhost:81/</a> the default provided by <strong>lighttpd</strong> home page</li>
<li><a href="http://localhost:81/lhinfo.php">http://localhost:81/lhinfo.php</a> my great application</li>
<li><a href="http://localhost:81/phpMyAdmin/">http://localhost:81/phpMyAdmin/</a> a packaged application</li>
</ul>
<h2>6. Conclusion</h2>
<p>It works !</p>PHP-FPM et LIGHTTPDurn:md5:8e087d0cd892e9b304d5ae00a83784d22010-09-28T18:43:00+02:002016-12-05T13:03:38+01:00RemiHowToFPMlighttpdPHP<p>Depuis <a hreflang="fr" href="https://blog.remirepo.net/post/2010/07/22/PHP-5.3.3-disponible">PHP 5.3.3</a>, le moteur <a hreflang="en" href="http://php-fpm.org/">PHP-FPM</a> est intégré. Le paquet <strong>php-fpm</strong> est disponible dans le dépôt <strong>remi</strong> est sera bientôt aussi dans <em>rawhide</em>.</p>
<p>Cet article montre comment l'utiliser avec le serveur <a href="http://www.lighttpd.net/">lighttpd</a>.</p> <p>L'objectif est de faire fonctionner un serveur Web pour des applications locales et pour des applications livrées en RPM, je prendrais <a hreflang="en" href="http://www.phpmyadmin.net/">phpMyAdmin</a> comme exemple.</p>
<h2>1. Installation :</h2>
<pre>yum --enablerepo=remi install php-fpm phpMyAdmin lighttpd-fastcgi</pre><p>Cette commande va aussi installer le serveur <strong>apache</strong>, qui écoute sur le port 80. Nous ne l'utiliserons pas mais configurerons <strong>lighttpd</strong> pour écouter sur le port 81.</p>
<h2>2. Création de mon site web</h2>
<p>Avec <strong>lighttpd</strong>, les pages sont, par défaut dans /var/www/lighttpd</p>
<p>Ce site sera vraiment minimum</p>
<pre>echo '<?php phpinfo(); ?>' >/var/www/lighttpd/lhinfo.php</pre>
<h2>3. Configuration de lighttpd</h2>
<p>Je suis loin d'être un expert sur ce serveur, mais à l'aide de la <a hreflang="en" href="http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs">documentation</a> (plutôt correcte), j'ai trouvé une solution qui marche :</p>
<p>Modification du fichier : /etc/lighttpd/lighttpd.conf</p>
<p><strong>Port</strong> d'écoute (dé-commenter et modifier le ligne) : </p>
<pre>server.port = 81</pre>
<p>Activation des <strong>modules</strong> nécessaires au fonctionnement (dé-commenter les lignes) :</p>
<pre>"mod_alias",<br />"mod_fastcgi",</pre>
<p>Configuration du module <strong>fastcgi</strong> (ajouter les lignes)</p>
<pre>fastcgi.server = ( ".php" =><br /> ((<br /> "host" => "127.0.0.1",<br /> "port" => 9000<br /> ))<br />)
</pre>
<p>Configuration de l'<strong>alias</strong> pour <strong>phpMyAdmin</strong>, création d'un fichier /etc/lighttpd/conf.d/phpMyAdmin.conf</p>
<pre> alias.url += ( "/phpMyAdmin" => "/usr/share/phpMyAdmin/" )</pre>
<h2>4. Lancement des services</h2>
<pre>service php-fpm start<br />service lighttpd start</pre>
<h2>5. URL de test</h2>
<ul>
<li><a href="http://localhost:81/">http://localhost:81/</a> page d'accueil fournie par défaut avec lighttpd</li>
<li><a href="http://localhost:81/lhinfo.php">http://localhost:81/lhinfo.php</a> notre superbe application</li>
<li><a href="http://localhost:81/phpMyAdmin/">http://localhost:81/phpMyAdmin/</a> une application RPM</li>
</ul>
<h2>6. Conclusion</h2>
<p>Ça marche !<!--/p--></p>PHP-FPM and NGINXurn:md5:0019c722bf469dda655414b308db24462010-09-27T19:14:00+02:002016-12-05T13:03:38+01:00RemiHowToFPMnginxPHP<p>Since <a hreflang="en" href="https://blog.remirepo.net/post/2010/07/22/PHP-5.3.3-released">PHP 5.3.3</a>, the <a hreflang="en" href="http://php-fpm.org/">PHP-FPM</a> engine is bundled. The <strong>php-fpm</strong> package is available in <strong>remi</strong> repository and will be soon in <em>rawhide</em>.</p>
<p>This entry show how to use it with the <a href="http://nginx.org/en/">nginx</a> web server.</p> <p>My goal is to install a working web server, for local and packaged (RPM) applications, I will use <a hreflang="en" href="http://www.phpmyadmin.net/">phpMyAdmin</a> as an example.</p>
<h2>1. Installation :</h2>
<pre>yum --enablerepo=remi install php-fpm nginx phpMyAdmin</pre><p>This command will also install the <strong>apache</strong> web server, listening on port 80. I will not use it, but I will configure <strong>nginx</strong> to listen on port 82.</p>
<h2>2. Creating my web site</h2>
<p>With <strong>nginx</strong>, pages are, by default, installed in the /usr/share/nginx/html directory.</p>
<p>My application will be very minimal:</p>
<pre>echo '<?php phpinfo(); ?>' >/usr/share/nginx/html/nginfo.php</pre>
<h2>3. Nginx configuration</h2>
<p>I'm really not an expert on this web server, but, reading the <a hreflang="en" href="http://wiki.nginx.org/Configuration">documentation</a> (quite minimal), I found a working solution:</p>
<p>Change in the /etc/nginx/nginx.conf file.</p>
<p><strong>Port</strong> : </p>
<pre> listen 82;</pre>
<p>Alias for <strong>phpMyAdmin</strong> (after the commented section about PHP)</p>
<pre> location /phpMyAdmin {
alias /usr/share/phpMyAdmin;
index index.php index.html index.htm;
}</pre>
<p>PHP Configuration for <strong>phpMyAdmin</strong></p>
<pre> location ~ /phpMyAdmin/.*\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/$uri;
fastcgi_intercept_errors on;
include fastcgi_params;
}
</pre>
<p>PHP configuration for <strong>my local application</strong></p>
<pre> location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
include fastcgi_params;
}
</pre>
<p>This is probably not the simplest / best solution (I'd like to not have to configure php twice), your comments are welcome, I will try to improve it.</p>
<h2>4. Launch the services</h2>
<pre>service php-fpm start<br />service nginx start</pre><h2>5. Test URL</h2>
<ul>
<li><a href="http://localhost:82/">http://localhost:82/</a> the default provided by <strong>nginx</strong> home page</li>
<li><a href="http://localhost:82/nginfo.php">http://localhost:82/nginfo.php</a> my great application</li>
<li><a href="http://localhost:82/phpMyAdmin/">http://localhost:82/phpMyAdmin/</a> a packaged application</li>
</ul>
<h2>6. Conclusion</h2>
<p>It works ! <!--/p--></p>