Caddy slow with php-fpm

1. Output of caddy version:

Caddy v2.6.1 h1:EDqo59TyYWhXQnfde93Mmv4FJfYe00dO60zMiEt+pzo=

2. How I run Caddy:

I run caddy in a docker-compose environment

a. System environment:

Docker-compose installed on debian 11

b. Command:

docker-stack deploy -c docker-compose.yml app

c. Service/unit/compose file:

version: "3.6"
services:
  # Déploiement du reverse proxy caddy (avec gestion certificats auto via let's encrypt
  caddy:
    image: caddy:latest
    ports:
    # HTTP et HTTPS
      - "80:80"
      - "443:443"
    networks:
      - caddy
    volumes:
      - ./apps/caddy/Caddyfile:/etc/caddy/Caddyfile:ro  #fichier de configuration principal de Caddy
      - ./data/caddy:/data  #indispensable pour stocker les données de certificats auto générés par caddy
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /mnt/existant/ademe/apps/public_html:/srv_ademe:ro
      #- ./apps/caddy/ademe:/cert_ademe:ro
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane. -->

d. My complete Caddy config:

{
    # email to generate a valid SSL certificate
    email mgagnant@wecompetence.com

}

# Snippet de règle de réécriture, permet d'être appelé en import dans chacun des sites php
(rewriterule) {
#On sécurise le site publié par caddy
header {
        Strict-Transport-Security max-age=31536000;
        X-Content-Type-Options nosniff;
        X-XSS-Protection "1; mode=block;"
        X-Robots-Tag none;
        X-Frame-Options SAMEORIGIN;
        Referrer-Policy no-referrer;
        Cache-Control max-age=31536000;
}
#Règle de réécriture de l'accueil Ademe
@accueil path_regexp accueil ^/accueil.*
rewrite @accueil /solutions/index.php
#Règle de réécriture des dossiers Ademe
@solfolder path_regexp solfolder .*f([0-9]+).html
rewrite @solfolder /solutions/folder.php?folid={re.solfolder.1}
#Règle de réécriture des stage Ademe
@solstage path_regexp solstage .*s([0-9]+).html
rewrite @solstage /solutions/stage.php?folid=26&stageid={re.solstage.1}
#Règle de réécriture des sessions (formulaire d'inscription) Ademe
@solinscr path_regexp solinscr .*r([0-9]+).html
rewrite @solinscr /solutions/beforeregister.php?sessionid={re.solfolder.1}
#Règle de réécriture recherche de formation (searchstage) Ademe
@searchstage path_regexp searchstage .*recherche-de-formation.html
rewrite @searchstage /solutions/searchstage.php
#Règle de réécriture contactez-nous (contact) Ademe
@contact path_regexp contact .*contactez-nous.html
rewrite @contact /solutions/contact.php
@contact-thankyou path_regexp contact-thankyou .*remerciements-contact.html
rewrite @contact-thankyou /solutions/contact-thankyou.php
#Règle de réécriture plan du site (sitemap) Ademe
@sitemap path_regexp sitemap .*plan-du-site.html
rewrite @sitemap /solutions/sitemap.php


#Règle de réécriture formulaire d'inscription (register & co) Ademe
# Voir l'envoi de variable en get pour rewriting entre beforeregister => register ex :(secteur=2&sessionid=1292&formval=Valider)
# Voir les actions des form pour le rewriting
@forminsc path_regexp forminsc .*formulaire-d-inscription.html
rewrite @forminsc /solutions/beforeregister.php
@register path_regexp register .*participant.html
rewrite @register /solutions/register.php
@register2 path_regexp register2 .*responsable.html
rewrite @register2 /solutions/register2.php
@register3 path_regexp register3 .*societe.html
rewrite @register3 /solutions/register3.php
@register4 path_regexp register4 .*facturation.html
rewrite @register4 /solutions/register4.php
@register5 path_regexp register5 .*message.html
rewrite @register5 /solutions/register5.php
@register6 path_regexp register6 .*synthese.html
rewrite @register6 /solutions/register6.php
@register7 path_regexp register7 .*enregistrement-formulaire-d-inscription.html
rewrite @register7 /solutions/register7.php
@register-thankyou path_regexp register-thankyou .*remerciements.html
rewrite @register-thankyou /solutions/register-thankyou.php

#Règle de réécriture formulaire création d'un compte (account & co)
# Voir l'envoi de variable en get pour rewriting entre beforecreateaccount => createaccount ex : (secteur=2&email=jlemoine45d@webcompetence.com)
# Voir les actions des form pour le rewriting
@beforecreateaccount path_regexp beforecreateaccount .*creation-de-compte.html
rewrite @beforecreateaccount /solutions/beforecreateaccount.php
@createaccount path_regexp createaccount .*creation-compte-vos-informations.html
rewrite @createaccount /solutions/createaccount.php
@createaccount2 path_regexp createaccount .*creation-compte-societe.html
rewrite @createaccount2 /solutions/createaccount2.php
@createaccount3 path_regexp createaccount3 .*creation-compte-message.html
rewrite @createaccount3 /solutions/createaccount3.php
@createaccount4 path_regexp createaccount4 .*creation-compte-synthese.html
rewrite @createaccount4 /solutions/createaccount4.php
@createaccount5 path_regexp createaccount5 .*creation-compte-enregistrement.html
rewrite @createaccount5 /solutions/createaccount5.php
@createaccount-thankyou path_regexp .*creation-compte-remerciement.html
rewrite @createaccount-thankyou /solutions/createaccount-thankyou.php

#Rewrite FAQ
@searchfaq path_regexp searchfaq .*faq.html
rewrite @searchfaq /solutions/searchfaq.php
#Règle de réécriture de la FAQ
@faq path_regexp faq .*a([0-9]+).html
rewrite @faq /solutions/faq.php?faqid={re.faq.1}
}

#***************************Déclaration Sites PHP clients*********************************
#client ADEME certificats fournis par le client
test.kalischool.com {
# On indique quel sera le dossier racine du module simpleSAMLpph
handle_path /simplesaml* {
  root * /srv_ademe/external/simplesamlphp/www
  php_fastcgi http://172.17.0.1:9001
  encode gzip zstd
  file_server
}
# On indique quel sera le dossier racine de l'application web cliente
handle {
  root * /srv_ademe
  php_fastcgi http://172.17.0.1:9001
  encode gzip zstd
  file_server
  #reverse_proxy * 172.17.0.1:9001
  try_files /{path} {path}/index.php /notfound.html
  import rewriterule
}
}     
Use `caddy fmt` to make it readable.
DO NOT REDACT anything except credentials.
LEAVE DOMAIN NAMES INTACT.
Make sure the backticks stay on their own lines.

3. The problem I’m having:

Hi the community,

my problem is that the webpage serving is very slow on my php-fpm container.
When you browse https://test.kalischool.com , the time for display the webpage is over than 1.5s (TTFB>1.5s).

Maybe something is not configured (cache ?)
Could you help me ?
Micka

4. Error messages and/or full log output:

{"level":"info","ts":1665071246.1081674,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"10.0.0.2","remote_port":"16687","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/","headers":{"Sec-Ch-Ua":["\"Google Chrome\";v=\"105\", \"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"105\""],"Sec-Ch-Ua-Platform":["\"Windows\""],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"],"Sec-Fetch-User":["?1"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"],"Sec-Ch-Ua-Mobile":["?0"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Dest":["document"],"Cookie":[]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"user_id":"","duration":0.061237692,"size":0,"status":302,"resp_headers":{"X-Robots-Tag":["none;"],"Strict-Transport-Security":["max-age=31536000;"],"Status":["302 Found"],"Content-Type":["text/html; charset=UTF-8"],"Server":["Caddy"],"Alt-Svc":["h3=\":443\"; ma=2592000"],"Referrer-Policy":["no-referrer;"],"X-Content-Type-Options":["nosniff;"],"X-Frame-Options":["SAMEORIGIN;"],"Location":["./accueil.html"],"X-Xss-Protection":["1; mode=block;"],"Cache-Control":["max-age=31536000;"]}}
{"level":"info","ts":1665071249.828001,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"10.0.0.2","remote_port":"16687","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/accueil.html","headers":{"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Sec-Ch-Ua":["\"Google Chrome\";v=\"105\", \"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"105\""],"Sec-Ch-Ua-Mobile":["?0"],"Accept-Encoding":["gzip, deflate, br"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"],"Cookie":[]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"user_id":"","duration":3.705047694,"size":8192,"status":302,"resp_headers":{"Cache-Control":["max-age=31536000;","no-store, no-cache, must-revalidate"],"Strict-Transport-Security":["max-age=31536000;"],"X-Content-Type-Options":["nosniff;"],"Expires":["Thu, 19 Nov 1981 08:52:00 GMT"],"Referrer-Policy":["no-referrer;"],"X-Frame-Options":["SAMEORIGIN;"],"Content-Type":["text/html; charset=UTF-8"],"Vary":["Accept-Encoding"],"Alt-Svc":["h3=\":443\"; ma=2592000"],"Status":["302 Found"],"Location":["https://test.kalischool.com/back/index.php"],"Content-Encoding":["gzip"],"Server":["Caddy"],"X-Robots-Tag":["none;"],"X-Xss-Protection":["1; mode=block;"],"Pragma":["no-cache"]}}
{"level":"info","ts":1665071255.1025906,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"10.0.0.2","remote_port":"16687","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/back/index.php","headers":{"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-User":["?1"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"],"Cookie":[],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Dest":["document"],"Sec-Ch-Ua":["\"Google Chrome\";v=\"105\", \"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"105\""],"Accept-Encoding":["gzip, deflate, br"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"user_id":"","duration":5.279715144,"size":14841,"status":200,"resp_headers":{"X-Content-Type-Options":["nosniff;"],"X-Frame-Options":["SAMEORIGIN;"],"Content-Type":["text/html; charset=UTF-8"],"Alt-Svc":["h3=\":443\"; ma=2592000"],"X-Xss-Protection":["1; mode=block;"],"Server":["Caddy"],"Pragma":["no-cache"],"Vary":["Accept-Encoding"],"Cache-Control":["max-age=31536000;","no-store, no-cache, must-revalidate"],"Referrer-Policy":["no-referrer;"],"Strict-Transport-Security":["max-age=31536000;"],"X-Robots-Tag":["none;"],"Expires":["Thu, 19 Nov 1981 08:52:00 GMT"],"Content-Encoding":["gzip"]}}
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

5. What I already tried:

I browse this website but I don’t find any answer for this problem

6. Links to relevant resources:

Unfortunately we don’t have enough information to help you until you follow the instructions on the Help template and fill it out completely. :frowning:

We need to know the exact version you’re using.

We also need your logs, to understand what’s going on. Enable the debug global option.

Hello Matt,
Sorry, I thought I had just filled out the form with as much information as possible.


Hello Francis
docker version:
v2.6.1 h1:EDqo59TyYWhXQnfde93Mmv4FJfYe00dO60zMiEt+pzo=

I put { debug } but where caddy store by default the debug log file please ? I never do this.

Thanks,
Micka

1 Like

I edit my first post with logs but I dunno if it is what you need Francis.

Micka.

The logs you’re showing are only access logs. It would be more helpful to see Caddy’s runtime logs, with debug turned on, to see what the reverse_proxy module is telling us.

What evidence do you have that this is a problem with Caddy, and not just a problem with your PHP app? Do you simply have slow database IO? etc.

1 Like

I put in my caddyfile the debug value but I have no more logs. Is it a correct config ? :
{
# email to generate a valid SSL certificate
debug
email mgagnant@wecompetence.com

}

Btw I have no evidence. I am trying to find the latency problem.
I will check also the mariadb IO.

That’s impossible. You definitely will have a lot more logs when you turn on debug mode. Check your container’s stdout log output. You can see those with docker logs caddy.

Not much we can do without any evidence.

Try to reduce the amount of variables. Simplify the PHP app you’re trying to run to just a simple “hello world” script. Is that still slow? If not, then the problem is probably with your PHP app itself.

1 Like

Hi Francis,

I try to do my best. I am a begginer in docker and caddy . My infrastructure is composed with 3 servers for the www app (docker : php, caddy, phpmyadmin,keepalived) and 3 servers for the mariadb database(docker: mariadb, keepalived). Im here for asking help. a script with only “hello world” is of course quick but it is a very simple webpage to display.

Here are my caddy debug logs:

{"level":"info","ts":1665238321.7361116,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"warn","ts":1665238321.7387962,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
{"level":"info","ts":1665238321.7402496,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1665238321.7404215,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
{"level":"info","ts":1665238321.740433,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"info","ts":1665238321.7404594,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0001faa10"}
{"level":"info","ts":1665238321.7414942,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1665238321.7415278,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
{"level":"info","ts":1665238321.7415357,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details."}
{"level":"debug","ts":1665238321.7415693,"logger":"http","msg":"starting server loop","address":"[::]:443","tls":true,"http3":true}
{"level":"info","ts":1665238321.741575,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"debug","ts":1665238321.7415867,"logger":"http","msg":"starting server loop","address":"[::]:80","tls":false,"http3":false}
{"level":"info","ts":1665238321.7415898,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"info","ts":1665238321.7415915,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["test.kalischool.com"]}
{"level":"debug","ts":1665238321.8368673,"logger":"tls","msg":"loading managed certificate","domain":"test.kalischool.com","expiration":1672756611,"issuer_key":"acme-v02.api.letsencrypt.org-directory","storage":"FileStorage:/data/caddy"}
{"level":"debug","ts":1665238321.8373122,"logger":"tls.cache","msg":"added certificate to cache","subjects":["test.kalischool.com"],"expiration":1672756611,"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"2e23752378956b3f812f358204fdcfed06ac53cfc3c174b0c250325cb663fe32","cache_size":1,"cache_capacity":10000}
{"level":"debug","ts":1665238321.8373325,"logger":"events","msg":"event","name":"cached_managed_cert","id":"b6c72703-5f9e-4abc-9d8d-6618edb813f7","origin":"tls","data":{"sans":["test.kalischool.com"]}}
{"level":"info","ts":1665238321.837476,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1665238321.8374827,"msg":"serving initial configuration"}
{"level":"info","ts":1665238322.0308797,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"debug","ts":1665238332.4533732,"logger":"events","msg":"event","name":"tls_get_certificate","id":"9a628c5b-3237-4cf2-9e80-9ff18f75eb67","origin":"tls","data":{"client_hello":{"CipherSuites":[51914,4865,4866,4867,49195,49199,49196,49200,52393,52392,49171,49172,156,157,47,53],"ServerName":"test.kalischool.com","SupportedCurves":[35466,29,23,24],"SupportedPoints":"AA==","SignatureSchemes":[1027,2052,1025,1283,2053,1281,2054,1537],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[23130,772,771],"Conn":{}}}}
{"level":"debug","ts":1665238332.4535344,"logger":"tls.handshake","msg":"choosing certificate","identifier":"test.kalischool.com","num_choices":1}
{"level":"debug","ts":1665238332.453555,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"test.kalischool.com","subjects":["test.kalischool.com"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"2e23752378956b3f812f358204fdcfed06ac53cfc3c174b0c250325cb663fe32"}
{"level":"debug","ts":1665238332.4535677,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"10.0.0.2","remote_port":"3148","subjects":["test.kalischool.com"],"managed":true,"expiration":1672756611,"hash":"2e23752378956b3f812f358204fdcfed06ac53cfc3c174b0c250325cb663fe32"}
{"level":"debug","ts":1665238332.527192,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/","headers":{"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"],"Accept-Encoding":["gzip, deflate, br"],"Cookie":[]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"method":"GET","uri":"/index.php"}
{"level":"debug","ts":1665238332.527343,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"172.17.0.1:9001","total_upstreams":1}
{"level":"debug","ts":1665238332.5274973,"logger":"http.reverse_proxy.transport.fastcgi","msg":"roundtrip","request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/index.php","headers":{"X-Forwarded-Proto":["https"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Accept-Encoding":["gzip, deflate, br"],"Sec-Fetch-Mode":["navigate"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"X-Forwarded-For":["10.0.0.2"],"X-Forwarded-Host":["test.kalischool.com"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Site":["none"],"Cookie":[]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"env":{"CONTENT_TYPE":"","QUERY_STRING":"","HTTP_ACCEPT":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","REMOTE_IDENT":"","REQUEST_METHOD":"GET","DOCUMENT_URI":"/index.php","SERVER_PORT":"443","HTTP_COOKIE":"","HTTP_SEC_FETCH_DEST":"document","HTTP_SEC_FETCH_MODE":"navigate","HTTP_X_FORWARDED_FOR":"10.0.0.2","REMOTE_HOST":"10.0.0.2","HTTP_X_FORWARDED_HOST":"test.kalischool.com","REMOTE_ADDR":"10.0.0.2","SERVER_NAME":"test.kalischool.com","REQUEST_URI":"/","HTTPS":"on","SSL_PROTOCOL":"TLSv1.3","HTTP_SEC_CH_UA_PLATFORM":"\"Windows\"","PATH_INFO":"","SSL_CIPHER":"TLS_AES_128_GCM_SHA256","REMOTE_USER":"","HTTP_SEC_CH_UA_MOBILE":"?0","HTTP_X_FORWARDED_PROTO":"https","HTTP_USER_AGENT":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36","HTTP_SEC_CH_UA":"\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"","SCRIPT_NAME":"/index.php","HTTP_SEC_FETCH_SITE":"none","HTTP_ACCEPT_ENCODING":"gzip, deflate, br","AUTH_TYPE":"","REMOTE_PORT":"3148","SERVER_PROTOCOL":"HTTP/2.0","DOCUMENT_ROOT":"/srv_ademe","HTTP_SEC_FETCH_USER":"?1","HTTP_ACCEPT_LANGUAGE":"fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6","HTTP_UPGRADE_INSECURE_REQUESTS":"1","CONTENT_LENGTH":"","REQUEST_SCHEME":"https","SERVER_SOFTWARE":"Caddy/v2.6.1","HTTP_HOST":"test.kalischool.com","SCRIPT_FILENAME":"/srv_ademe/index.php","GATEWAY_INTERFACE":"CGI/1.1"},"dial":"172.17.0.1:9001","env":{"SERVER_SOFTWARE":"Caddy/v2.6.1","HTTP_HOST":"test.kalischool.com","SCRIPT_FILENAME":"/srv_ademe/index.php","GATEWAY_INTERFACE":"CGI/1.1","REQUEST_SCHEME":"https","QUERY_STRING":"","HTTP_ACCEPT":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","REMOTE_IDENT":"","CONTENT_TYPE":"","DOCUMENT_URI":"/index.php","SERVER_PORT":"443","HTTP_COOKIE":"","HTTP_SEC_FETCH_DEST":"document","HTTP_SEC_FETCH_MODE":"navigate","HTTP_X_FORWARDED_FOR":"10.0.0.2","REMOTE_HOST":"10.0.0.2","REQUEST_METHOD":"GET","HTTP_X_FORWARDED_HOST":"test.kalischool.com","SERVER_NAME":"test.kalischool.com","REQUEST_URI":"/","HTTPS":"on","SSL_PROTOCOL":"TLSv1.3","HTTP_SEC_CH_UA_PLATFORM":"\"Windows\"","PATH_INFO":"","REMOTE_ADDR":"10.0.0.2","REMOTE_USER":"","SSL_CIPHER":"TLS_AES_128_GCM_SHA256","HTTP_X_FORWARDED_PROTO":"https","HTTP_USER_AGENT":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36","HTTP_SEC_CH_UA":"\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"","SCRIPT_NAME":"/index.php","HTTP_SEC_CH_UA_MOBILE":"?0","HTTP_ACCEPT_ENCODING":"gzip, deflate, br","AUTH_TYPE":"","HTTP_SEC_FETCH_SITE":"none","SERVER_PROTOCOL":"HTTP/2.0","DOCUMENT_ROOT":"/srv_ademe","HTTP_SEC_FETCH_USER":"?1","HTTP_ACCEPT_LANGUAGE":"fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6","HTTP_UPGRADE_INSECURE_REQUESTS":"1","CONTENT_LENGTH":"","REMOTE_PORT":"3148"},"request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/index.php","headers":{"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"Sec-Ch-Ua-Platform":["\"Windows\""],"X-Forwarded-Proto":["https"],"Sec-Fetch-Mode":["navigate"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"],"Accept-Encoding":["gzip, deflate, br"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"X-Forwarded-For":["10.0.0.2"],"X-Forwarded-Host":["test.kalischool.com"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Site":["none"],"Cookie":[]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}}}
{"level":"debug","ts":1665238332.599714,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"172.17.0.1:9001","duration":0.072289237,"request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/index.php","headers":{"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Site":["none"],"Cookie":[],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"Sec-Ch-Ua-Platform":["\"Windows\""],"X-Forwarded-Proto":["https"],"Sec-Fetch-Mode":["navigate"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"],"Accept-Encoding":["gzip, deflate, br"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"X-Forwarded-For":["10.0.0.2"],"X-Forwarded-Host":["test.kalischool.com"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"headers":{"Status":["302 Found"],"Location":["./accueil.html"],"Content-Type":["text/html; charset=UTF-8"]},"status":302}
{"level":"debug","ts":1665238332.6628351,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/accueil.html","headers":{"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"],"Sec-Fetch-Site":["none"],"Accept-Encoding":["gzip, deflate, br"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Mode":["navigate"],"Cookie":[]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"method":"GET","uri":"/solutions/index.php"}
{"level":"debug","ts":1665238332.6860788,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"172.17.0.1:9001","total_upstreams":1}
{"level":"debug","ts":1665238332.6862557,"logger":"http.reverse_proxy.transport.fastcgi","msg":"roundtrip","request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/solutions/index.php","headers":{"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Accept-Encoding":["gzip, deflate, br"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Sec-Fetch-User":["?1"],"Cookie":[],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"X-Forwarded-Proto":["https"],"Sec-Fetch-Dest":["document"],"X-Forwarded-For":["10.0.0.2"],"X-Forwarded-Host":["test.kalischool.com"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"Sec-Fetch-Mode":["navigate"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"],"Sec-Ch-Ua-Mobile":["?0"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"env":{"GATEWAY_INTERFACE":"CGI/1.1","REMOTE_IDENT":"","SERVER_SOFTWARE":"Caddy/v2.6.1","HTTP_SEC_FETCH_DEST":"document","REQUEST_SCHEME":"https","HTTP_SEC_CH_UA":"\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"","HTTP_X_FORWARDED_FOR":"10.0.0.2","HTTP_SEC_FETCH_MODE":"navigate","HTTP_SEC_FETCH_SITE":"none","CONTENT_LENGTH":"","PATH_INFO":"","SSL_CIPHER":"TLS_AES_128_GCM_SHA256","HTTP_ACCEPT_LANGUAGE":"fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6","HTTP_X_FORWARDED_HOST":"test.kalischool.com","HTTP_SEC_CH_UA_PLATFORM":"\"Windows\"","AUTH_TYPE":"","REMOTE_PORT":"3148","SCRIPT_FILENAME":"/srv_ademe/solutions/index.php","SSL_PROTOCOL":"TLSv1.3","REMOTE_HOST":"10.0.0.2","REQUEST_URI":"/accueil.html","SERVER_PORT":"443","HTTP_X_FORWARDED_PROTO":"https","HTTP_SEC_FETCH_USER":"?1","HTTP_UPGRADE_INSECURE_REQUESTS":"1","REMOTE_USER":"","SCRIPT_NAME":"/solutions/index.php","HTTPS":"on","HTTP_ACCEPT_ENCODING":"gzip, deflate, br","QUERY_STRING":"","REQUEST_METHOD":"GET","SERVER_PROTOCOL":"HTTP/2.0","DOCUMENT_ROOT":"/srv_ademe","HTTP_HOST":"test.kalischool.com","HTTP_COOKIE":"","HTTP_USER_AGENT":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36","CONTENT_TYPE":"","REMOTE_ADDR":"10.0.0.2","SERVER_NAME":"test.kalischool.com","DOCUMENT_URI":"/solutions/index.php","HTTP_SEC_CH_UA_MOBILE":"?0","HTTP_ACCEPT":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"},"dial":"172.17.0.1:9001","env":{"REQUEST_SCHEME":"https","HTTP_SEC_CH_UA":"\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"","HTTP_X_FORWARDED_FOR":"10.0.0.2","HTTP_SEC_FETCH_MODE":"navigate","HTTP_SEC_FETCH_SITE":"none","CONTENT_LENGTH":"","PATH_INFO":"","SSL_CIPHER":"TLS_AES_128_GCM_SHA256","HTTP_ACCEPT_LANGUAGE":"fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6","HTTP_X_FORWARDED_HOST":"test.kalischool.com","HTTP_SEC_CH_UA_PLATFORM":"\"Windows\"","AUTH_TYPE":"","REMOTE_PORT":"3148","SCRIPT_FILENAME":"/srv_ademe/solutions/index.php","SSL_PROTOCOL":"TLSv1.3","REMOTE_HOST":"10.0.0.2","REQUEST_URI":"/accueil.html","SERVER_PORT":"443","HTTP_X_FORWARDED_PROTO":"https","HTTP_SEC_FETCH_USER":"?1","HTTP_UPGRADE_INSECURE_REQUESTS":"1","REMOTE_USER":"","SCRIPT_NAME":"/solutions/index.php","HTTPS":"on","HTTP_ACCEPT_ENCODING":"gzip, deflate, br","QUERY_STRING":"","REQUEST_METHOD":"GET","SERVER_PROTOCOL":"HTTP/2.0","DOCUMENT_ROOT":"/srv_ademe","HTTP_HOST":"test.kalischool.com","HTTP_COOKIE":"","HTTP_USER_AGENT":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36","CONTENT_TYPE":"","REMOTE_ADDR":"10.0.0.2","SERVER_NAME":"test.kalischool.com","DOCUMENT_URI":"/solutions/index.php","HTTP_SEC_CH_UA_MOBILE":"?0","HTTP_ACCEPT":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","GATEWAY_INTERFACE":"CGI/1.1","REMOTE_IDENT":"","SERVER_SOFTWARE":"Caddy/v2.6.1","HTTP_SEC_FETCH_DEST":"document"},"request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/solutions/index.php","headers":{"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Mode":["navigate"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"],"Accept-Encoding":["gzip, deflate, br"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"X-Forwarded-Proto":["https"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-User":["?1"],"Cookie":[],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"X-Forwarded-For":["10.0.0.2"],"X-Forwarded-Host":["test.kalischool.com"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}}}
{"level":"debug","ts":1665238347.3046985,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"172.17.0.1:9001","duration":14.61852652,"request":{"remote_ip":"10.0.0.2","remote_port":"3148","proto":"HTTP/2.0","method":"GET","host":"test.kalischool.com","uri":"/solutions/index.php","headers":{"Sec-Ch-Ua-Platform":["\"Windows\""],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Accept-Encoding":["gzip, deflate, br"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-User":["?1"],"Cookie":[],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"],"X-Forwarded-Proto":["https"],"Sec-Ch-Ua":["\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""],"X-Forwarded-For":["10.0.0.2"],"X-Forwarded-Host":["test.kalischool.com"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Mode":["navigate"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"test.kalischool.com"}},"headers":{"Expires":["Thu, 19 Nov 1981 08:52:00 GMT"],"Cache-Control":["no-store, no-cache, must-revalidate"],"Pragma":["no-cache"],"Content-Type":["text/html; charset=UTF-8"]},"status":200}

USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

Wow, yeah, this roundtrip to your backend took 14 seconds. (/solutions/index.php)

What is the code for that page?

Note that other roundtrips, like to /index.php are only taking 0.07 seconds.

Hello Matt, thanks for your reply.

here is the code for /solutions/index.php

In my running architecture (with apache and no docker) it works very fast (130ms). on the new with docker and caddy 14s…
Did the rewriting rules can do this ? maybe I misconfigure one ?

Thanks for helping me !

Micka

4. Error messages and/or full log output:

<?php
include("../lib/global.inc.php");
include("../lib/front.inc.php");
include("../lib/init.inc.php");
include("../lib/session.inc.php");
include("../lib/strconv.inc.php");
include("../lib/search.inc.php");
include("../lib/cache.inc.php");
include("../lib/parser.inc.php");
include("../lib/folback.inc.php");
include("../lib/animfront.inc.php");
include("../lib/allnews.inc.php");

include("../lib/form-load-settings.inc.php");
$strrubnumber="";

$lngpageaccueil=1;

$lngfolid=0;
$strmessage=f_request2("message");
$lngid=f_stringtoint(f_request2("schid"));
f_animgetcurrent($lngid,1,$strurlhp,$strtitrehp,$strblochp);

$lngtypctx=1;
$strresult=f_gettemplate($preflang_session,$memberrank_session,$lngtypobj,$lngid,$lngtypctx,1,$intcontenttype,$lngphpscriptid,$lngoutput,$lngcurrentmenu);

//Left side menu generation
f_folbuildmenu(0, 0, 0);
$lngtabselected=1;

//f_allnewsbuildmenu(0,0);
//$lngtabselected=3;

//initialisation variable condition Header
global $intnotstylecss;
$intnotstylecss = 0;

include("../lib/form-front-form-begin.inc.php");
$strslideraccueil=f_slideraccueil($lngctxid);
$stractusaccueil=f_displayaccueilactu($lngctxid);
$strlastformaccueil=f_displaylastformation(2);
$strlistgranddomaine=f_displaydomaines(1,"(ID_TRAIN_HIST_DOMAINE_IMPORT=0 OR ID_TRAIN_HIST_DOMAINE_IMPORT IS NULL) AND (ID_YES_NO=1 OR ID_YES_NO IS NULL)","DISPLAY_ORDER");

$strfolderlist="";
//Retrieving template for a folder displayed in home page's folders list
//$strfoltpl=f_gettemplate($preflang_session,$memberrank_session,6,1,6,0,$intcontenttype,$lngphpscriptid,$lngoutput,$lngcurrentmenu);

$strresult=f_folsubstvars($strresult);
$strresult=f_animsubstvars($strresult,$strurlhp,$strtitrehp,$strblochp);
$strresult=f_substvarauto($strresult);

$stroutput.=$strresult;
include("../lib/form-front-form-end.inc.php");

f_pageecho("",$stroutput,"");

?>

USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

Hello, I had a similar problem with php-fpm and nginx on production deployment, in our development environment we’ve been using an all-in-one container which is consist of nginx+php-fpm in the same container and it was fast, but in our production environment, the nginx and the application were seperate containers and it was unexpectedly slow.

A quoute from the serversideup/docker-php

Wait… Isn’t Docker supposed to be a “single process per container”? Yes, that’s what it’s like in a perfect world. Unfortunately PHP isn’t like that. You need both a web server and a PHP-FPM server to see your files in order for your application to load.

After that we’ve moved to s6-overlay based image with a web-server and php-fpm and all the things have become fast again, the web server in the container acts as an interface to php-fpm. I suggest you to exeperiment on this and see the result. We’re also not having a scalability problem in our end, the web server in the container acts as a reverse proxy to the application and all reverse proxies exposed to the real world using a load balancer.

1 Like

Hi Alicanyildiz,

thanks for taking time to answer. Unfortunately it seems to be that the problem is that I have 3 servers in 3 differents locations in France… When I put the docker db and the docker www in two differents servers BUT in same location datacenter it is fast.

I continue my tests…

Micka

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.