0

I would like to configure Apache, such that when we send a request with a given language header, the server should send us back the right version. For example, I have index.eng.html and index.de.html. Based on the HTTP header, server should send me the proper version. I want to make it inside a Docker container.

Now the only thing I see is the directory listing ... What is wrong?

# Use the official Apache base image
FROM httpd:latest

# Install required Apache modules
RUN apt-get update && apt-get install -y apache2

# Enable necessary Apache modules
RUN a2enmod negotiation

# Copy the content files to the appropriate directory
COPY index.eng.html index.de.html index.pl.html /usr/local/apache2/htdocs/

# Append the configuration directly to the Apache configuration file
RUN echo "LoadModule negotiation_module modules/mod_negotiation.so" >> /usr/local/apache2/conf/httpd.conf
RUN echo "LanguagePriority en pl de" >> /usr/local/apache2/conf/httpd.conf
RUN echo "ForceLanguagePriority Prefer Fallback" >> /usr/local/apache2/conf/httpd.conf

EXPOSE 80

# Remove the default index.html file
RUN rm /usr/local/apache2/htdocs/index.html

# Start Apache in the foreground
CMD ["httpd", "-D", "FOREGROUND"]
mazix
  • 65
  • 1
  • 8

0 Answers0