SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

La actualidad más candente (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
 

Similar a Apache ha muerto, Viva Lighttpd

Similar a 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
 

Último

TEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptx
TEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptxTEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptx
TEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptxterciariojaussaudr
 
informacion-finanTFHHETHAETHciera-2022.pdf
informacion-finanTFHHETHAETHciera-2022.pdfinformacion-finanTFHHETHAETHciera-2022.pdf
informacion-finanTFHHETHAETHciera-2022.pdfPriscilaBermello
 
DERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJO
DERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJODERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJO
DERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJOkcastrome
 
S05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwww
S05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwwwS05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwww
S05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwwwssuser999064
 
modulo+penal+del+16+al+20+hhggde+enero.pdf
modulo+penal+del+16+al+20+hhggde+enero.pdfmodulo+penal+del+16+al+20+hhggde+enero.pdf
modulo+penal+del+16+al+20+hhggde+enero.pdfmisssusanalrescate01
 
mapa-conceptual-evidencias-de-auditoria_compress.pdf
mapa-conceptual-evidencias-de-auditoria_compress.pdfmapa-conceptual-evidencias-de-auditoria_compress.pdf
mapa-conceptual-evidencias-de-auditoria_compress.pdfAndresSebastianTamay
 
2 Tipo Sociedad comandita por acciones.pptx
2 Tipo Sociedad comandita por acciones.pptx2 Tipo Sociedad comandita por acciones.pptx
2 Tipo Sociedad comandita por acciones.pptxRicardo113759
 
4 Tipos de Empresa Sociedad colectiva.pptx
4 Tipos de Empresa Sociedad colectiva.pptx4 Tipos de Empresa Sociedad colectiva.pptx
4 Tipos de Empresa Sociedad colectiva.pptxRicardo113759
 
senati-powerpoint_5TOS-_ALUMNOS (1).pptx
senati-powerpoint_5TOS-_ALUMNOS (1).pptxsenati-powerpoint_5TOS-_ALUMNOS (1).pptx
senati-powerpoint_5TOS-_ALUMNOS (1).pptxnathalypaolaacostasu
 
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
 
EL REFERENDO para una exposición de sociales
EL REFERENDO para una exposición de socialesEL REFERENDO para una exposición de sociales
EL REFERENDO para una exposición de socialeszaidylisbethnarvaezm
 
Comparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdf
Comparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdfComparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdf
Comparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdfAJYSCORP
 
INTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptx
INTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptxINTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptx
INTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptxRENANRODRIGORAMIREZR
 
Empresa Sazonadores Lopesa estudio de mercado
Empresa Sazonadores Lopesa estudio de mercadoEmpresa Sazonadores Lopesa estudio de mercado
Empresa Sazonadores Lopesa estudio de mercadoPsicoterapia Holística
 
Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...
Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...
Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...MIGUELANGELLEGUIAGUZ
 
SENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdf
SENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdfSENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdf
SENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdfJaredQuezada3
 
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
 
____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
 
el impuesto genera A LAS LAS lasventas IGV
el impuesto genera A LAS  LAS lasventas IGVel impuesto genera A LAS  LAS lasventas IGV
el impuesto genera A LAS LAS lasventas IGVTeresa Rc
 
implemenatcion de un data mart en logistica
implemenatcion de un data mart en logisticaimplemenatcion de un data mart en logistica
implemenatcion de un data mart en logisticaghgfhhgf
 

Último (20)

TEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptx
TEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptxTEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptx
TEORÍAS DE LA MOTIVACIÓN Recursos Humanos.pptx
 
informacion-finanTFHHETHAETHciera-2022.pdf
informacion-finanTFHHETHAETHciera-2022.pdfinformacion-finanTFHHETHAETHciera-2022.pdf
informacion-finanTFHHETHAETHciera-2022.pdf
 
DERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJO
DERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJODERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJO
DERECHO EMPRESARIAL - SEMANA 01 UNIVERSIDAD CESAR VALLEJO
 
S05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwww
S05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwwwS05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwww
S05_s2+Prueba+d.pdfsfeaefadwwwwwwwwwwwwwwwwwwwwwwwwww
 
modulo+penal+del+16+al+20+hhggde+enero.pdf
modulo+penal+del+16+al+20+hhggde+enero.pdfmodulo+penal+del+16+al+20+hhggde+enero.pdf
modulo+penal+del+16+al+20+hhggde+enero.pdf
 
mapa-conceptual-evidencias-de-auditoria_compress.pdf
mapa-conceptual-evidencias-de-auditoria_compress.pdfmapa-conceptual-evidencias-de-auditoria_compress.pdf
mapa-conceptual-evidencias-de-auditoria_compress.pdf
 
2 Tipo Sociedad comandita por acciones.pptx
2 Tipo Sociedad comandita por acciones.pptx2 Tipo Sociedad comandita por acciones.pptx
2 Tipo Sociedad comandita por acciones.pptx
 
4 Tipos de Empresa Sociedad colectiva.pptx
4 Tipos de Empresa Sociedad colectiva.pptx4 Tipos de Empresa Sociedad colectiva.pptx
4 Tipos de Empresa Sociedad colectiva.pptx
 
senati-powerpoint_5TOS-_ALUMNOS (1).pptx
senati-powerpoint_5TOS-_ALUMNOS (1).pptxsenati-powerpoint_5TOS-_ALUMNOS (1).pptx
senati-powerpoint_5TOS-_ALUMNOS (1).pptx
 
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
 
EL REFERENDO para una exposición de sociales
EL REFERENDO para una exposición de socialesEL REFERENDO para una exposición de sociales
EL REFERENDO para una exposición de sociales
 
Comparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdf
Comparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdfComparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdf
Comparativo DS 024-2016-EM vs DS 023-2017-EM - 21.08.17 (1).pdf
 
INTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptx
INTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptxINTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptx
INTERESES Y MULTAS DEL IMPUESTO A LA RENTA POWER POINT.pptx
 
Empresa Sazonadores Lopesa estudio de mercado
Empresa Sazonadores Lopesa estudio de mercadoEmpresa Sazonadores Lopesa estudio de mercado
Empresa Sazonadores Lopesa estudio de mercado
 
Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...
Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...
Tesis_liderazgo_desempeño_laboral_colaboradores_cooperativa_agraria_rutas_Inc...
 
SENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdf
SENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdfSENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdf
SENTENCIA COLOMBIA DISCRIMINACION SELECCION PERSONAL.pdf
 
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
 
____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...
 
el impuesto genera A LAS LAS lasventas IGV
el impuesto genera A LAS  LAS lasventas IGVel impuesto genera A LAS  LAS lasventas IGV
el impuesto genera A LAS LAS lasventas IGV
 
implemenatcion de un data mart en logistica
implemenatcion de un data mart en logisticaimplemenatcion de un data mart en logistica
implemenatcion de un data mart en logistica
 

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.