Misc

In case of error with the module or a website, here is some information that will be useful to find the source of the problem.

Installation

Sometimes Apache will takes too long to close therefore Nginx can not run on port 80 because since it is still in use. When this problem happens, just force Apache to stop and restart Apache and Nginx.

If the installation was closed by mistake or seems to stuck in a loop, first check with the "top" tool to make sure it does not do anything. Write down the PID number and kill the process. Then restart it.

Ports

When the acceleration module is enabled, Nginx will use port 80 and port 443 and Apache will use port 8080 and port 8443. If you want to set up the cache on a site and you see abnormal behavior, you can unblock the Apache ports in the firewall. You will then be able to compare a site with cache and without cache, without having to disable and re-enable caching.

Cloudflare

When you use Cloudflare free SSL certificate without having one on your hosting, you must choose to CloudFlare "flexible" SSL mode. However, this mode is problematic with the caching module. The problem is not related to caching, but with the redirection that occurs when communicating between Cloudflare and Nginx servers.

What is the cause of the problem?

When a site uses a flexible Cloudflare certificate, communication between the visitor and Cloudflare is secure, but communication between Cloudflare and the website is not.

Visitor--- HTTPS ---> Cloudflare --- HTTP --- > Website

Several CMS (Content Management System), like WordPress, may encounter infinite loop problems with this type of communication since they should normally always be accessed using HTTPS (in secure mode). So this creates the following scenario:

  1. The visitor requests the page: https://example.com (with HTTPS)
  2. Cloudflare receives the request for https://example.com (with HTTPS)
  3. Cloudflare communicates with the web server on http://example.com (without HTTPS)
  4. The site receives the unsecured request from Cloudflare.
  5. The site redirects the request to https://example.com (with HTTPS)
  6. Return to point number 2 and the loop continues endlessly.

Two solutions are possible to solve this problem.

  • Change the type of certificate used at Cloudflare from "flexible" to "full" AND install an SSL certificate on the site, whether it is self-signed or issued by a CA.
    or:
  • Add the line "$ _SERVER ['HTTPS'] = 'on'; "(Without the" ") in the configuration file of your CMS. For WordPress, insert this line in the "wp-config.php" file.
Divers

En cas d’erreur avec le module ou bien un site web, voici quelques informations qui vous seront utiles afin de trouver la source du problème.

Installation

Parfois, Apache prend trop de temps à se fermer ce qui fait en sorte que Nginx ne peut se lancer sur le port 80, car ce dernier est toujours en utilisation. Lorsque ce problème arrive, il suffit de forcer l’arrêt d’Apache et de redémarrer Apache et Nginx.

Si l’installation a été fermée par erreur ou semble tourner en boucle, commencez par vérifier avec l’outil « top » pour vous assurer qu’elle n’effectue plus rien. Notez le numéro de PID puis tuez le processus. Relancez-le par la suite.

Ports

Lorsque le module d’accélération est activé, Nginx se trouve à utiliser le port 80 et le port 443. Pour ce qui est d'Apache, celui-ci utilisera le port 8080 et le port 8443. Si vous désirez mettre en place la cache sur un site et que vous voyez un comportement anormal, vous pouvez débloquer les ports d’Apache dans le pare-feu. Il vous sera alors possible de comparer un site avec cache et sans cache, sans avoir à désactiver et réactiver la mise en cache.

Cloudflare

Lorsque vous utilisez Cloudflare afin d'obtenir un certificat SSL gratuit sans en avoir réellement un sur votre hébergement, normalement il faut choisir d’utiliser le mode « flexible ». Cependant, ce mode pose problème avec le module de cache. Le problème n’est pas relié à la mise en cache, mais bien avec la redirection qui se fait lors de la communication entre les serveurs de Cloudflare et Nginx.

Quelle est la cause du problème ?

Lorsqu’un site utilise un certificat flexible de Cloudflare, la communication entre le visiteur et Cloudflare est sécurisée, cependant la communication entre Cloudflare et le site web ne l’est pas.

Visiteur --- HTTPS ---> Cloudflare --- HTTP --- > Site web

Plusieurs CMS (Content Management System), comme WordPress, peuvent rencontrer des problèmes de boucle infinie avec ce type de communication puisqu’ils devraient normalement toujours être accédés en utilisant HTTPS (en mode sécurisé). Donc ceci crée le scénario suivant :

  1. Le visiteur demande la page : https://exemple.com (avec HTTPS)
  2. Cloudflare reçoit la demande pour https://exemple.com (avec HTTPS)
  3. Cloudflare communique avec le serveur web sur http://exemple.com (sans HTTPS)
  4. Le site reçoit la demande non sécurisée de Cloudflare.
  5. Le site redirige la demande vers https://exemple.com (avec HTTPS)
  6. Retour au point numéro 2 et la boucle se poursuit sans fin.

Deux solutions sont possibles pour régler cette problématique.

  • Changer le type de certificat utilisé chez Cloudflare de « flexible » à « full » ET installer un certificat SSL sur le site, qu’il soit autosigné ou émis par une autorité de certification.
    ou :
  • Ajouter la ligne « $_SERVER['HTTPS']='on'; » (sans les « ») dans le fichier de configuration de votre CMS. Pour WordPress, il s’agit d’insérer cette ligne dans le fichier « wp-config.php ».
Sidebar