refs #5576 perf: move files
This commit is contained in:
parent
d0ff8ba57f
commit
3a265a7add
|
@ -0,0 +1,30 @@
|
|||
# Usa la imagen oficial de Apache
|
||||
FROM httpd:latest
|
||||
|
||||
# Añade configuración del MPM prefork
|
||||
# RUN echo "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo "LoadModule mpm_worker_module modules/mod_mpm_worker.so" >> /usr/local/apache2/conf/httpd.conf
|
||||
|
||||
# Copia tu archivo de configuración personalizado (si lo tienes)
|
||||
# COPY ./mi-configuracion-httpd.conf /usr/local/apache2/conf/httpd.conf
|
||||
COPY ./image.png /usr/local/apache2/htdocs/
|
||||
COPY ./image.png /usr/local/apache2/htdocs/welcome.png
|
||||
COPY ./.htaccess /usr/local/apache2/htdocs/
|
||||
RUN { \
|
||||
echo 'IncludeOptional conf.d/*.conf'; \
|
||||
} >> /usr/local/apache2/conf/httpd.conf \
|
||||
&& mkdir /usr/local/apache2/conf.d
|
||||
# Copy .htaccess into DocumentRoot
|
||||
COPY ./.htaccess /var/www/html/
|
||||
# Habilita el módulo mod_rewrite
|
||||
RUN sed -i 's/#LoadModule rewrite_module/LoadModule rewrite_module/' /usr/local/apache2/conf/httpd.conf
|
||||
# RUN sed -i 's/#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so' /usr/local/apache2/conf/httpd.conf
|
||||
# RUN sed -i 's/#LoadModule mpm_prefork_module/LoadModule mpm_prefork_module/' /usr/local/apache2/conf/httpd.conf
|
||||
# RUN sed -i 's/#LoadModule mpm_worker_module modules/mod_mpm_worker.so' /usr/local/apache2/conf/httpd.conf
|
||||
# RUN sed -i 's/#LoadModule mpm_worker_module/LoadModule mpm_worker_module/' /usr/local/apache2/conf/httpd.conf
|
||||
|
||||
# Establece el propietario del directorio del servidor a www-data (usuario de Apache)
|
||||
RUN chown -R www-data:www-data /usr/local/apache2/htdocs/
|
||||
|
||||
# Expón el puerto 80 para que sea accesible desde fuera del contenedor
|
||||
EXPOSE 80
|
|
@ -0,0 +1,24 @@
|
|||
# <IfModule mpm_prefork_module>
|
||||
# LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
|
||||
# </IfModule>
|
||||
|
||||
<IfModule mpm_worker_module>
|
||||
LoadModule mpm_worker_module modules/mod_mpm_worker.so
|
||||
</IfModule>
|
||||
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# Asegúrate de que el módulo crypto esté disponible
|
||||
RewriteCond %{LA-U:CRYPTO:crypto} ^$
|
||||
|
||||
# Obtén el nombre del archivo sin la extensión
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.+)\.png$ - [E=FILENAME_NO_EXT:$1]
|
||||
|
||||
# Calcula el hash del nombre del archivo
|
||||
RewriteCond %{LA-U:CRYPTO:crypto} ^(.+)$
|
||||
RewriteRule ^(.+)\.png$ /images/%1.png [L]
|
||||
</IfModule>
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
for collection in */ ; do
|
||||
for size in "$collection"*/ ; do
|
||||
for image in "$size"* ; do
|
||||
fileName=$(basename "$image")
|
||||
imageName="${fileName%.*}"
|
||||
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
||||
path=$(dirname "$image")/${hash:2:2}/${hash:0:2}
|
||||
mkdir -p $path
|
||||
mv $image $path/$fileName
|
||||
ln -s $path/$fileName $fileName
|
||||
done
|
||||
done
|
||||
done
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
for collection in */ ; do
|
||||
for size in "$collection"*/ ; do
|
||||
for image in "$size"* ; do
|
||||
fileName=$(basename "$image")
|
||||
imageName="${fileName%.*}"
|
||||
hash=$(echo -n "$imageName" | sha1sum | awk '{print $1}')
|
||||
mkdir -p $(dirname "$image")/${hash:2:2}/${hash:0:2}
|
||||
ln -s $image $(dirname "$image")/${hash:2:2}/${hash:0:2}/$fileName
|
||||
done
|
||||
done
|
||||
done
|
Loading…
Reference in New Issue