Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

2.6K
Visualizações
How to enable mod_rewrite module for docker official httpd image?

I am running a LAMP stack in docker with the help from docker-compose, and for the webserver I am using the official image from https://hub.docker.com/_/httpd. The httpd container is created by a Dockerfile:

ARG APACHE_VERSION
FROM httpd:$APACHE_VERSION
RUN apt-get update;\apt-get upgrade;\a2enmod rewrite
COPY demo.apache.conf /usr/local/apache2/conf/demo.apache.conf
RUN echo "Include /usr/local/apache2/conf/demo.apache.conf" \
    >> /usr/local/apache2/conf/httpd.conf

I am trying to enable mod_rewrite with the \a2enmod rewrite command but I get the following error during build:

/bin/sh: 1: a2enmod: not found
ERROR: Service 'apache' failed to build: The command '/bin/sh -c apt-get update;\apt-get upgrade;\a2enmod rewrite' returned a non-zero code: 127

a2enmod is failing – from my reading it's only available in a debian system and the httpd base image doesn't have it.

How can I enable mod_rewrite module for this docker official httpd image during build?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I ended up figuring it out. I had to enable the module in the apache .conf file by adding the line:

LoadModule rewrite_module modules/mod_rewrite.so
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda