# Use HTTPD image from quay.io FROM quay.io/centos/httpd-24-centos7:latest # Set environment variables for Apache configuration ENV HTTPD_MPM=event \ HTTPD_START_SERVERS=2 \ HTTPD_MAX_CONNECTIONS_PER_CHILD=1000 \ HTTPD_MAX_REQUEST_WORKERS=100 \ HTTPD_MAX_SPARE_THREADS=75 \ HTTPD_MIN_SPARE_THREADS=25 \ HTTPD_THREAD_LIMIT=64 \ HTTPD_THREADS_PER_CHILD=25 # Copy website files to the default Apache document root COPY . /var/www/html/ # Create a custom Apache configuration file COPY < Options Indexes FollowSymLinks AllowOverride None Require all granted # Enable compression for text files AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json # Set caching headers for static assets Header set Cache-Control "max-age=86400, public" # Alias for /blog to serve from the blog directory Alias "/blog" "/var/www/html/blog" # Configure DirectoryIndex for both root and blog directory DirectoryIndex index.html DirectoryIndex index.html # Custom error pages ErrorDocument 404 /404.html ErrorDocument 500 /500.html # Enable .html extension to be optional RewriteEngine On # For URLs like /blog/hello-world (without .html) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.+)$ $1.html [L,QSA] EOF # Create empty 404 and 500 error pages if they don't exist RUN if [ ! -f /var/www/html/404.html ]; then \ echo "404 Not Found

404 Not Found

The page you requested could not be found.

Return to home