SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Apache ha muerto  Viva LIGHTTPD! [email_address] * No creo realmente que el Apache haya muerto, pero si que ahora hay mas opciones, algunas mucho mas interesantes, como Lighty. El titulo de la presentacion es para provocar, nomas.
Características ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
La  filosofía   Lighty ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Cuando si, cuando no ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Quien usa Lighttpd ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Módulos  disponibles ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Problemas y soluciones ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Configuración condicional ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FastCGI ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Apache mod_php vs FastCGI ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1 servidor HTTP, 3 servidores PHP FastCGI FastCGI FastCGI HTTP
Balanceo de Carga PHP ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Un servidor por "zona" $HTTP["url"] =~ " ^/forum " { proxy-core.protocol = "fastcgi" proxy-core.backends = ( " 10.0.0.1:1000 ") } $HTTP["url"] =~ " ^/torrents " { proxy-core.protocol = "fastcgi" proxy-core.backends = ( " 10.0.0.99:1000 ") }
Distribuyendo la carga  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Distribuyendo la carga $HTTP["url"] =~ "php$" { proxy-core.protocol = "fastcgi" proxy-core.backends = ( "10.0.0.1:1000" ) } else $HTTP["url"] =~ "^/images/[0-4]/" { proxy-core.protocol = "http" proxy-core.backends = ( "10.0.0.2:80" ) } else $HTTP["url"] =~ "^/images/[5-9]/" { proxy-core.protocol = "http" proxy-core.backends = ( "10.0.0.3:80" ) } The web is a pipe!
Sirviendo downloads "protegidos" ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sirviendo archivos "protegidos" ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Solución  Lighty recanchera ,[object Object],[object Object],[object Object],[object Object],[object Object],<?php if (usuario_registrado())  header(&quot;X-Sendfile: /opt/files/pescaditos.exe&quot;);
Scripteando las tripas de Lighty ,[object Object],[object Object],[object Object],[object Object],[object Object]
Un archivo al azar En PHP, PHP+X-Sendfile y LUA <?php header(&quot;Content-Type: image/png&quot;); print file_get_contents(&quot;imgs/&quot;.rand(0,9).&quot;.png&quot;); <?php header(&quot;Content-Type: image/png&quot;); header(&quot;X-Sendfile: &quot;.getcwd(). &quot;/imgs/&quot;.rand(0,9).&quot;.png&quot;); lighty.env[&quot;request.uri&quot;]=&quot;/imgs/&quot; ..  math.random(9) .. &quot;.png&quot; return lighty.RESTART_REQUEST
magnet, minibenchmark ,[object Object],[object Object],[object Object],[object Object]
magnet: cache html  ,[object Object],[object Object],[object Object],[object Object]
magnet: cache html  Guardar el output HTML en el archivo temporal: <?php function cache_html(){ function write_html($text){ $info = stat($_SERVER[&quot;SCRIPT_FILENAME&quot;]);  file_put_contents(&quot;/tmp/&quot;.$info['ino'].&quot;.html&quot;,$text); return false; } ob_start(&quot;write_html&quot;); }
magnet: cache html  Devolver el contenido del archivo temporal si existe y terminar la ejecucion (PHP): <?php function show_cached(){ $info = stat($_SERVER[&quot;SCRIPT_FILENAME&quot;]); $cache_file = &quot;/tmp/&quot;.$info['ino'].&quot;.html&quot;; if (file_exists($cache_file)){ print file_get_contents($cache_file); exit; } }
magnet: cache html  Devolver el contenido del archivo temporal si existe y terminar la ejecucion (LUA): info = lighty.stat(lighty.env[&quot;physical.path&quot;]) cache_path = &quot;/tmp/&quot;..info[&quot;st_ino&quot;]..&quot;.html&quot; cache_info = lighty.stat(cache_path) if (cache_info) then lighty.env[&quot;physical.path&quot;] = cache_path end
magnet: cache html  ,[object Object],[object Object],[object Object]
Ayuda, por dios! ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Creative Commons  Attribution-Noncommercial Share Alike 2.5  Argentina License

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Servidor http
Servidor httpServidor http
Servidor http
 
Presentacion ventajas y desventajas de un servidor compartido
Presentacion ventajas y desventajas de un servidor compartidoPresentacion ventajas y desventajas de un servidor compartido
Presentacion ventajas y desventajas de un servidor compartido
 
Servidor http(web)
Servidor http(web)Servidor http(web)
Servidor http(web)
 
Cuadro comparativo de apache y iis
Cuadro comparativo de apache y iisCuadro comparativo de apache y iis
Cuadro comparativo de apache y iis
 
Servicios de red amp
Servicios de red   ampServicios de red   amp
Servicios de red amp
 
Tabla comparativa servidores web
Tabla comparativa servidores webTabla comparativa servidores web
Tabla comparativa servidores web
 
Qué es un servidor web
Qué es un servidor webQué es un servidor web
Qué es un servidor web
 
Mapa Conceptual de los Servidor Apache y IIS.
Mapa Conceptual de los Servidor Apache y IIS.Mapa Conceptual de los Servidor Apache y IIS.
Mapa Conceptual de los Servidor Apache y IIS.
 
Cliente web
Cliente web Cliente web
Cliente web
 
¿Cómo elegir servidor web?
¿Cómo elegir servidor web?¿Cómo elegir servidor web?
¿Cómo elegir servidor web?
 
Servidor WEB y FTP
Servidor WEB y FTPServidor WEB y FTP
Servidor WEB y FTP
 
Recuperacion
RecuperacionRecuperacion
Recuperacion
 
Servidor web
Servidor webServidor web
Servidor web
 
Servidores web
Servidores webServidores web
Servidores web
 
Curso TIC de PHP y MSQL Parte 1
Curso TIC de PHP y MSQL Parte 1Curso TIC de PHP y MSQL Parte 1
Curso TIC de PHP y MSQL Parte 1
 
Clientes web
Clientes webClientes web
Clientes web
 
Mantenimiento Servidor de correo
Mantenimiento Servidor de correo Mantenimiento Servidor de correo
Mantenimiento Servidor de correo
 
CUADRO COMPARATIVO TIPOS DE SERVIDORES Y EL MANEJO DE SUS DATOS
CUADRO COMPARATIVO TIPOS DE SERVIDORES Y EL MANEJO DE SUS DATOS CUADRO COMPARATIVO TIPOS DE SERVIDORES Y EL MANEJO DE SUS DATOS
CUADRO COMPARATIVO TIPOS DE SERVIDORES Y EL MANEJO DE SUS DATOS
 
Cuadro comparativo 2
Cuadro comparativo 2Cuadro comparativo 2
Cuadro comparativo 2
 
Cliente web y servidor web
Cliente web y servidor webCliente web y servidor web
Cliente web y servidor web
 

Ähnlich wie Apache ha muerto, Viva Lighttpd

Ähnlich wie Apache ha muerto, Viva Lighttpd (20)

Curso de php
Curso de phpCurso de php
Curso de php
 
Performance en Drupal 7
Performance en Drupal 7Performance en Drupal 7
Performance en Drupal 7
 
Rendimiento extremo en php
Rendimiento extremo en phpRendimiento extremo en php
Rendimiento extremo en php
 
High performance Web Sites
High performance Web SitesHigh performance Web Sites
High performance Web Sites
 
Introducción a PHP5
Introducción a PHP5Introducción a PHP5
Introducción a PHP5
 
PHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdf
PHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdfPHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdf
PHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdf PHP.pdf
 
ROA - Resource Oriented Architecture
ROA - Resource Oriented ArchitectureROA - Resource Oriented Architecture
ROA - Resource Oriented Architecture
 
Java 7- Java Day Guatemala
Java 7- Java Day GuatemalaJava 7- Java Day Guatemala
Java 7- Java Day Guatemala
 
Aspnet40 Cache Extensibility
Aspnet40 Cache ExtensibilityAspnet40 Cache Extensibility
Aspnet40 Cache Extensibility
 
Http al descubierto
Http al descubiertoHttp al descubierto
Http al descubierto
 
Http al descubierto
Http al descubiertoHttp al descubierto
Http al descubierto
 
Sacándole el jugo a apache
Sacándole el jugo a apacheSacándole el jugo a apache
Sacándole el jugo a apache
 
Scripting para Pentesters v1.0
Scripting para Pentesters v1.0Scripting para Pentesters v1.0
Scripting para Pentesters v1.0
 
Hacking uploaders
Hacking uploadersHacking uploaders
Hacking uploaders
 
Symfony2: Optimización y rendimiento
Symfony2: Optimización y rendimientoSymfony2: Optimización y rendimiento
Symfony2: Optimización y rendimiento
 
Bulma 441
Bulma 441Bulma 441
Bulma 441
 
PHP IUTE
PHP IUTEPHP IUTE
PHP IUTE
 
Plone en La Jornada
Plone en La JornadaPlone en La Jornada
Plone en La Jornada
 
PHP en el 2015
PHP en el 2015PHP en el 2015
PHP en el 2015
 
DiseñO Pagina Web
DiseñO Pagina WebDiseñO Pagina Web
DiseñO Pagina Web
 

Kürzlich hochgeladen

Reporte Tributario para Entidades Financieras.pdf
Reporte Tributario para Entidades Financieras.pdfReporte Tributario para Entidades Financieras.pdf
Reporte Tributario para Entidades Financieras.pdfjosephtena
 
260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptx
260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptx260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptx
260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptxi7ingenieria
 
Presentacion encuentra tu creatividad papel azul.pdf
Presentacion encuentra tu creatividad papel azul.pdfPresentacion encuentra tu creatividad papel azul.pdf
Presentacion encuentra tu creatividad papel azul.pdfaldonaim115
 
CARPETA PEDAGOGICA 2024 ARITA.sadasdasddocx
CARPETA PEDAGOGICA 2024 ARITA.sadasdasddocxCARPETA PEDAGOGICA 2024 ARITA.sadasdasddocx
CARPETA PEDAGOGICA 2024 ARITA.sadasdasddocxWILIANREATEGUI
 
DECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADA
DECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADADECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADA
DECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADAgordonruizsteffy
 
Sostenibilidad y continuidad huamcoli robin-cristian.pptx
Sostenibilidad y continuidad huamcoli robin-cristian.pptxSostenibilidad y continuidad huamcoli robin-cristian.pptx
Sostenibilidad y continuidad huamcoli robin-cristian.pptxmarlonrea6
 
Maria_diaz.pptx mapa conceptual gerencia industral
Maria_diaz.pptx mapa conceptual   gerencia industralMaria_diaz.pptx mapa conceptual   gerencia industral
Maria_diaz.pptx mapa conceptual gerencia industralmaria diaz
 
CORRIENTES DEL PENSAMIENTO ECONÓMICO.pptx
CORRIENTES DEL PENSAMIENTO ECONÓMICO.pptxCORRIENTES DEL PENSAMIENTO ECONÓMICO.pptx
CORRIENTES DEL PENSAMIENTO ECONÓMICO.pptxJOHUANYQUISPESAEZ
 
Catalogo de tazas para la tienda nube de dostorosmg
Catalogo de tazas para la tienda nube de dostorosmgCatalogo de tazas para la tienda nube de dostorosmg
Catalogo de tazas para la tienda nube de dostorosmgdostorosmg
 
Contabilidad Gubernamental guia contable
Contabilidad Gubernamental guia contableContabilidad Gubernamental guia contable
Contabilidad Gubernamental guia contableThairyAndreinaLira1
 
____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...
____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...
____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...BaleriaMaldonado1
 
3ro - Semana 1 (EDA 2) 2023 (3).ppt. edx
3ro - Semana 1 (EDA 2) 2023 (3).ppt. edx3ro - Semana 1 (EDA 2) 2023 (3).ppt. edx
3ro - Semana 1 (EDA 2) 2023 (3).ppt. edxEvafabi
 
CRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docx
CRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docxCRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docx
CRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docxgeuster2
 
CAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABA
CAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABACAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABA
CAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABAJuan Luis Menares, Arquitecto
 
Manual de Imagen Personal y uso de uniformes
Manual de Imagen Personal y uso de uniformesManual de Imagen Personal y uso de uniformes
Manual de Imagen Personal y uso de uniformesElizabeth152261
 
Correcion del libro al medio hay sitio.pptx
Correcion del libro al medio hay sitio.pptxCorrecion del libro al medio hay sitio.pptx
Correcion del libro al medio hay sitio.pptxHARLYJHANSELCHAVEZVE
 
CONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdf
CONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdfCONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdf
CONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdfTeresa Rc
 
Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)
Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)
Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)KwNacional
 
GUIA UNIDAD 3 costeo variable fce unc.docx
GUIA UNIDAD 3 costeo variable fce unc.docxGUIA UNIDAD 3 costeo variable fce unc.docx
GUIA UNIDAD 3 costeo variable fce unc.docxAmyKleisinger
 
DISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBRE
DISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBREDISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBRE
DISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBREdianayarelii17
 

Kürzlich hochgeladen (20)

Reporte Tributario para Entidades Financieras.pdf
Reporte Tributario para Entidades Financieras.pdfReporte Tributario para Entidades Financieras.pdf
Reporte Tributario para Entidades Financieras.pdf
 
260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptx
260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptx260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptx
260813887-diagrama-de-flujo-de-proceso-de-esparrago-fresco-verde.pptx
 
Presentacion encuentra tu creatividad papel azul.pdf
Presentacion encuentra tu creatividad papel azul.pdfPresentacion encuentra tu creatividad papel azul.pdf
Presentacion encuentra tu creatividad papel azul.pdf
 
CARPETA PEDAGOGICA 2024 ARITA.sadasdasddocx
CARPETA PEDAGOGICA 2024 ARITA.sadasdasddocxCARPETA PEDAGOGICA 2024 ARITA.sadasdasddocx
CARPETA PEDAGOGICA 2024 ARITA.sadasdasddocx
 
DECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADA
DECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADADECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADA
DECRETO-2535-DE-1993-pdf.pdf VIGILANCIA PRIVADA
 
Sostenibilidad y continuidad huamcoli robin-cristian.pptx
Sostenibilidad y continuidad huamcoli robin-cristian.pptxSostenibilidad y continuidad huamcoli robin-cristian.pptx
Sostenibilidad y continuidad huamcoli robin-cristian.pptx
 
Maria_diaz.pptx mapa conceptual gerencia industral
Maria_diaz.pptx mapa conceptual   gerencia industralMaria_diaz.pptx mapa conceptual   gerencia industral
Maria_diaz.pptx mapa conceptual gerencia industral
 
CORRIENTES DEL PENSAMIENTO ECONÓMICO.pptx
CORRIENTES DEL PENSAMIENTO ECONÓMICO.pptxCORRIENTES DEL PENSAMIENTO ECONÓMICO.pptx
CORRIENTES DEL PENSAMIENTO ECONÓMICO.pptx
 
Catalogo de tazas para la tienda nube de dostorosmg
Catalogo de tazas para la tienda nube de dostorosmgCatalogo de tazas para la tienda nube de dostorosmg
Catalogo de tazas para la tienda nube de dostorosmg
 
Contabilidad Gubernamental guia contable
Contabilidad Gubernamental guia contableContabilidad Gubernamental guia contable
Contabilidad Gubernamental guia contable
 
____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...
____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...
____ABC de las constelaciones con enfoque centrado en soluciones - Gabriel de...
 
3ro - Semana 1 (EDA 2) 2023 (3).ppt. edx
3ro - Semana 1 (EDA 2) 2023 (3).ppt. edx3ro - Semana 1 (EDA 2) 2023 (3).ppt. edx
3ro - Semana 1 (EDA 2) 2023 (3).ppt. edx
 
CRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docx
CRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docxCRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docx
CRITERIOS DE EVALUACIÓN - NIVEL INICIAL.docx
 
CAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABA
CAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABACAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABA
CAMBIO DE USO DE SUELO LO BARNECHEA - VITACURA - HUECHURABA
 
Manual de Imagen Personal y uso de uniformes
Manual de Imagen Personal y uso de uniformesManual de Imagen Personal y uso de uniformes
Manual de Imagen Personal y uso de uniformes
 
Correcion del libro al medio hay sitio.pptx
Correcion del libro al medio hay sitio.pptxCorrecion del libro al medio hay sitio.pptx
Correcion del libro al medio hay sitio.pptx
 
CONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdf
CONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdfCONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdf
CONSTITUCIÓN POLÍTICA DEL PERÚ al 25082023.pdf
 
Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)
Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)
Ficha de datos de seguridad MSDS Ethanol (Alcohol etílico)
 
GUIA UNIDAD 3 costeo variable fce unc.docx
GUIA UNIDAD 3 costeo variable fce unc.docxGUIA UNIDAD 3 costeo variable fce unc.docx
GUIA UNIDAD 3 costeo variable fce unc.docx
 
DISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBRE
DISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBREDISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBRE
DISEÑO DE ESTRATEGIAS EN MOMENTOS DE INCERTIDUMBRE
 

Apache ha muerto, Viva Lighttpd

  • 1. Apache ha muerto Viva LIGHTTPD! [email_address] * No creo realmente que el Apache haya muerto, pero si que ahora hay mas opciones, algunas mucho mas interesantes, como Lighty. El titulo de la presentacion es para provocar, nomas.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. 1 servidor HTTP, 3 servidores PHP FastCGI FastCGI FastCGI HTTP
  • 12.
  • 13. Un servidor por &quot;zona&quot; $HTTP[&quot;url&quot;] =~ &quot; ^/forum &quot; { proxy-core.protocol = &quot;fastcgi&quot; proxy-core.backends = ( &quot; 10.0.0.1:1000 &quot;) } $HTTP[&quot;url&quot;] =~ &quot; ^/torrents &quot; { proxy-core.protocol = &quot;fastcgi&quot; proxy-core.backends = ( &quot; 10.0.0.99:1000 &quot;) }
  • 14.
  • 15. Distribuyendo la carga $HTTP[&quot;url&quot;] =~ &quot;php$&quot; { proxy-core.protocol = &quot;fastcgi&quot; proxy-core.backends = ( &quot;10.0.0.1:1000&quot; ) } else $HTTP[&quot;url&quot;] =~ &quot;^/images/[0-4]/&quot; { proxy-core.protocol = &quot;http&quot; proxy-core.backends = ( &quot;10.0.0.2:80&quot; ) } else $HTTP[&quot;url&quot;] =~ &quot;^/images/[5-9]/&quot; { proxy-core.protocol = &quot;http&quot; proxy-core.backends = ( &quot;10.0.0.3:80&quot; ) } The web is a pipe!
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. Un archivo al azar En PHP, PHP+X-Sendfile y LUA <?php header(&quot;Content-Type: image/png&quot;); print file_get_contents(&quot;imgs/&quot;.rand(0,9).&quot;.png&quot;); <?php header(&quot;Content-Type: image/png&quot;); header(&quot;X-Sendfile: &quot;.getcwd(). &quot;/imgs/&quot;.rand(0,9).&quot;.png&quot;); lighty.env[&quot;request.uri&quot;]=&quot;/imgs/&quot; .. math.random(9) .. &quot;.png&quot; return lighty.RESTART_REQUEST
  • 21.
  • 22.
  • 23. magnet: cache html Guardar el output HTML en el archivo temporal: <?php function cache_html(){ function write_html($text){ $info = stat($_SERVER[&quot;SCRIPT_FILENAME&quot;]); file_put_contents(&quot;/tmp/&quot;.$info['ino'].&quot;.html&quot;,$text); return false; } ob_start(&quot;write_html&quot;); }
  • 24. magnet: cache html Devolver el contenido del archivo temporal si existe y terminar la ejecucion (PHP): <?php function show_cached(){ $info = stat($_SERVER[&quot;SCRIPT_FILENAME&quot;]); $cache_file = &quot;/tmp/&quot;.$info['ino'].&quot;.html&quot;; if (file_exists($cache_file)){ print file_get_contents($cache_file); exit; } }
  • 25. magnet: cache html Devolver el contenido del archivo temporal si existe y terminar la ejecucion (LUA): info = lighty.stat(lighty.env[&quot;physical.path&quot;]) cache_path = &quot;/tmp/&quot;..info[&quot;st_ino&quot;]..&quot;.html&quot; cache_info = lighty.stat(cache_path) if (cache_info) then lighty.env[&quot;physical.path&quot;] = cache_path end
  • 26.
  • 27.