salix/images/Dockerfile

56 lines
2.6 KiB
Docker
Raw Normal View History

2023-12-15 20:55:38 +00:00
FROM httpd:latest
2023-12-16 21:52:12 +00:00
# Habilitar mod_rewrite y configurar Apache
RUN apt-get update && apt-get install -y curl libcgi-pm-perl
# Habilitar mod_rewrite y mod_cgi
RUN sed -i '/mod_rewrite/s/^#//g' /usr/local/apache2/conf/httpd.conf
2023-12-15 20:55:38 +00:00
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
2023-12-16 21:52:12 +00:00
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
2023-12-15 20:55:38 +00:00
2023-12-16 21:52:12 +00:00
# Habilitar mod_rewrite si aún no está habilitado
2023-12-15 20:55:38 +00:00
RUN sed -i '/mod_rewrite/s/^#//g' /usr/local/apache2/conf/httpd.conf
2023-12-16 21:52:12 +00:00
# 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
2023-12-15 20:55:38 +00:00
COPY cgi-bin/ /usr/local/apache2/cgi-bin/
2023-12-16 21:52:12 +00:00
# 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/
2023-12-15 20:55:38 +00:00
# Copia las imágenes al directorio htdocs/images
2023-12-16 23:07:33 +00:00
# COPY images/ /usr/local/apache2/htdocs/images/
2023-12-15 20:55:38 +00:00
# Copia el archivo .htaccess para configurar el directorio htdocs/images
2023-12-16 21:52:12 +00:00
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
2023-12-16 23:07:33 +00:00
# CMD y ENTRYPOINT para iniciar Apache2, según la imagen original
CMD ["httpd-foreground"]