refs #5576 perf: remove bad code
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
f450472915
commit
1196b32148
|
@ -1,55 +1,32 @@
|
|||
FROM httpd:latest
|
||||
|
||||
# Habilitar mod_rewrite y configurar Apache
|
||||
|
||||
RUN apt-get update && apt-get install -y curl libcgi-pm-perl
|
||||
# Habilitar mod_rewrite y mod_cgi
|
||||
|
||||
# Habilitar mod_rewrite
|
||||
RUN sed -i '/mod_rewrite/s/^#//g' /usr/local/apache2/conf/httpd.conf
|
||||
RUN sed -i '/mod_cgi/s/^#//g' /usr/local/apache2/conf/httpd.conf
|
||||
RUN echo "AddHandler cgi-script .cgi .pl" >> /usr/local/apache2/conf/httpd.conf
|
||||
RUN echo "Include conf/extra/httpd-vhosts.conf" >> /usr/local/apache2/conf/httpd.conf
|
||||
|
||||
# Habilitar mod_cgi
|
||||
RUN sed -i '/mod_cgi/s/^#//g' /usr/local/apache2/conf/httpd.conf
|
||||
RUN echo "LoadModule cgid_module modules/mod_cgid.so" >> /usr/local/apache2/conf/httpd.conf
|
||||
|
||||
# Habilitar mod_rewrite si aún no está habilitado
|
||||
RUN sed -i '/mod_rewrite/s/^#//g' /usr/local/apache2/conf/httpd.conf
|
||||
# Habilitar reescritura
|
||||
RUN echo "RewriteEngine On" >> /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
||||
|
||||
# Configurar Apache para ejecutar scripts CGI
|
||||
# RUN echo "ScriptAlias /cgi-bin/ \"/usr/local/apache2/cgi-bin/\"" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo "<Directory \"/usr/local/apache2/cgi-bin\">" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo " AllowOverride None" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo " Options +ExecCGI" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo " Require all granted" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo "</Directory>" >> /usr/local/apache2/conf/httpd.conf
|
||||
|
||||
# Configurar Apache para ejecutar scripts CGI
|
||||
# RUN echo "<Directory \"/usr/local/apache2/htdocs\">" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo " Options +ExecCGI" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo " AllowOverride None" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo " AddHandler cgi-script .cgi .pl" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo " Require all granted" >> /usr/local/apache2/conf/httpd.conf
|
||||
# RUN echo "</Directory>" >> /usr/local/apache2/conf/httpd.conf
|
||||
# Copiar scripts CGI al directorio correspondiente
|
||||
COPY cgi-bin/ /usr/local/apache2/cgi-bin/
|
||||
|
||||
|
||||
# Copiar la configuración de Apache2 y los archivos del sitio
|
||||
COPY apache2.conf /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
||||
|
||||
# RUN chmod +x www/script.pl
|
||||
COPY www/ /usr/local/apache2/htdocs/
|
||||
|
||||
# Copia las imágenes al directorio htdocs/images
|
||||
# COPY images/ /usr/local/apache2/htdocs/images/
|
||||
|
||||
# Copia el archivo .htaccess para configurar el directorio htdocs/images
|
||||
COPY .htaccess /usr/local/apache2/htdocs/
|
||||
RUN chmod +x /usr/local/apache2/htdocs/script.pl
|
||||
RUN chmod +x /usr/local/apache2/cgi-bin/script.pl
|
||||
|
||||
# Habilitar reescritura y reiniciar Apache2
|
||||
RUN echo "RewriteEngine On" >> /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
||||
RUN echo "Include conf/extra/httpd-vhosts.conf" >> /usr/local/apache2/conf/httpd.conf
|
||||
# Habilita permisos de ejecución
|
||||
RUN chmod +x /usr/local/apache2/htdocs/script.pl
|
||||
|
||||
# CMD y ENTRYPOINT para iniciar Apache2, según la imagen original
|
||||
CMD ["httpd-foreground"]
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<Directory "/usr/local/apache2/cgi-bin">
|
||||
|
||||
Options +ExecCGI
|
||||
AddHandler cgi-script .pl
|
||||
</Directory>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /images/
|
||||
RewriteRule ^(.*)$ /cgi-bin/script.pl?nombre=$1 [L,QSA,NC]
|
||||
</IfModule>
|
||||
|
||||
<!--
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^(.*)$ index.php [QSA,L]
|
||||
</IfModule> -->
|
|
@ -1,12 +1,6 @@
|
|||
# apache2.conf
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /usr/local/apache2/htdocs
|
||||
<Directory "/usr/local/apache2/cgi-bin">
|
||||
Options +ExecCGI
|
||||
AddHandler cgi-script .cgi .pl
|
||||
Require all granted
|
||||
</Directory>
|
||||
<Directory "/usr/local/apache2/htdocs">
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
Options +ExecCGI
|
||||
AddHandler cgi-script .pl
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
print "Content-type: text/html\n\n";
|
||||
print "<html><head><title>Hola Mundo en Perl</title></head><body>";
|
||||
print "<h1>Hola Mundo desde Perl</h1>";
|
||||
print "</body></html>";
|
|
@ -1,18 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5;
|
||||
|
||||
# Leer el nombre del archivo desde la consulta
|
||||
my $archivo = $ENV{'QUERY_STRING'};
|
||||
|
||||
# Calcular el MD5 del nombre del archivo
|
||||
my $md5 = Digest::MD5->new;
|
||||
$md5->add($archivo);
|
||||
my $hash = $md5->hexdigest;
|
||||
|
||||
# Imprimir el resultado
|
||||
print "Content-type: text/html\n\n";
|
||||
print "<html><head><title>MD5 del nombre del archivo</title></head><body>";
|
||||
print "<h1>MD5 del nombre del archivo: $hash</h1>";
|
||||
print "</body></html>";
|
|
@ -1,27 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5;
|
||||
use File::Basename;
|
||||
|
||||
sub calcular_hash {
|
||||
my ($archivo) = @_;
|
||||
|
||||
# Obtener solo el nombre del archivo sin la ruta
|
||||
my $nombre_archivo = fileparse($archivo);
|
||||
|
||||
# Calcular el hash MD5 del nombre del archivo
|
||||
my $md5 = Digest::MD5->new;
|
||||
$md5->add($nombre_archivo);
|
||||
my $hash = $md5->hexdigest;
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
# Obtener el nombre del archivo de la URL
|
||||
my $archivo_url = $ENV{'REQUEST_URI'};
|
||||
my $hash_archivo = calcular_hash($archivo_url);
|
||||
|
||||
# Imprimir el hash como respuesta
|
||||
print "Content-type: text/plain\n\n";
|
||||
print "Hash del nombre del archivo: $hash_archivo\n";
|
|
@ -3,7 +3,6 @@ services:
|
|||
apache:
|
||||
volumes:
|
||||
- ./images:/usr/local/apache2/htdocs/images/
|
||||
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
# # httpd.conf
|
||||
# <Directory "/usr/local/apache2/cgi-bin">
|
||||
# AllowOverride All
|
||||
# Options +ExecCGI
|
||||
# Require all granted
|
||||
# </Directory>
|
||||
|
||||
# # httpd.conf
|
||||
# <IfModule mpm_prefork_module>
|
||||
# StartServers 5
|
||||
# MinSpareServers 5
|
||||
# MaxSpareServers 10
|
||||
# MaxClients 150
|
||||
# MaxRequestsPerChild 0
|
||||
# </IfModule>
|
||||
|
||||
|
||||
# # httpd.conf
|
||||
# <Directory "/usr/local/apache2/htdocs">
|
||||
# AllowOverride All
|
||||
# Require all granted
|
||||
# </Directory>
|
|
@ -1,2 +0,0 @@
|
|||
<script src="./script.js"></script>
|
||||
<div id="header"></div>
|
|
@ -1,4 +0,0 @@
|
|||
console.log('adios');
|
||||
|
||||
window.onload = function() {
|
||||
};
|
|
@ -1,8 +0,0 @@
|
|||
console.log('hola');
|
||||
window.onload = function() {
|
||||
// document.body = '<img src="" alt="" srcset="">';
|
||||
let img = document.createElement('img');
|
||||
img.src = '../../images/_DSC5302.jpg';
|
||||
let src = document.getElementById('header');
|
||||
src.appendChild(img);
|
||||
};
|
|
@ -12,45 +12,29 @@ my $new_path;
|
|||
|
||||
# Dividir la ruta usando el símbolo "/" para extraaer el nombre del archivo SIN extension
|
||||
my $fileName= (split('/', $input_name))[-1];
|
||||
|
||||
# Dividir la ruta usando el símbolo "/" para extraaer el nombre del archivo CON extension
|
||||
my $file= (split('/', $input_value))[-1];
|
||||
my $exists = -e "$input_value";
|
||||
# print $exists;
|
||||
# $exists = -e "$input_value";
|
||||
# print $exists;
|
||||
|
||||
# Compruebo si existe el archivo en la caperta general o no
|
||||
if($exists) {
|
||||
# print "Content-type: text/html\n\n";
|
||||
$new_path ="$input_value";
|
||||
# print "<h1>$new_path</h1>";
|
||||
} else {
|
||||
# Calcula el valor hash MD5 del string
|
||||
my $hash_value = sha1_hex($fileName);
|
||||
|
||||
# Obtiene solo los 2 primeros caracteres del hash MD5
|
||||
my $first_characters = substr($hash_value, 0, 2);
|
||||
|
||||
# Obtiene solo los 2 segundos caracteres del hash MD5
|
||||
my $second_characters = substr($hash_value, 1, 2);
|
||||
|
||||
$new_path ="images/$first_characters/$second_characters/$file";
|
||||
# Imprime el resultado
|
||||
# Establecer el tipo de contenido a imagen JPEG
|
||||
# print "Content-type: text/html\n\n";
|
||||
# print "<h1>Ultimo elemento es: $fileName</h1>";
|
||||
# print "<h1>input_name==>$input_name</h1>";
|
||||
# print "<h1>input_value==>$input_value</h1>";
|
||||
# print "<h1>fileName==>$fileName</h1>";
|
||||
# print "<h1>file==>$file</h1>";
|
||||
# print "<h1>hash_value==>$hash_value</h1>";
|
||||
# print "<h1>first_characters==>$first_characters/$second_characters/$input_value</h1>";
|
||||
# print "<h1>new_path==>$new_path</h1>";
|
||||
|
||||
# Abre la imagen en modo binario
|
||||
|
||||
# open my $imagen, '<', $new_path or die "No se pudo abrir la imagen: $!";
|
||||
|
||||
}
|
||||
# Verifica si $imagen está definida antes de intentar usarla
|
||||
if (defined $new_path) {
|
||||
abrir_imagen($new_path);
|
||||
# print "<h1>HOLA</h1>";
|
||||
}
|
||||
sub abrir_imagen {
|
||||
my ($ruta) = @_;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
# 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
|
|
@ -1,24 +0,0 @@
|
|||
# <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>
|
Loading…
Reference in New Issue