Apache HTTP Server
This service deploys Apache HTTP Server, a popular open-source web server.
Services
apache: The Apache HTTP Server service.
Environment Variables
| Variable Name | Description | Default Value |
|---|---|---|
| APACHE_VERSION | Apache HTTP Server image version | 2.4.62-alpine3.20 |
| APACHE_HTTP_PORT_OVERRIDE | Host port mapping for HTTP (maps to port 80) | 80 |
| APACHE_HTTPS_PORT_OVERRIDE | Host port mapping for HTTPS (maps to port 443) | 443 |
| APACHE_RUN_USER | User to run Apache as | www-data |
| APACHE_RUN_GROUP | Group to run Apache as | www-data |
Please modify the .env file as needed for your use case.
Volumes
apache_logs: A volume for storing Apache logs../htdocs: Directory for web content (mounted as read-only)../httpd.conf: Optional custom Apache configuration file../ssl: Optional SSL certificates directory.
Usage
-
Create the service directory structure:
mkdir -p htdocs -
Add your web content to the
htdocsdirectory:echo "<h1>Hello World</h1>" > htdocs/index.html -
Start the service:
docker compose up -d -
Access the web server at
http://localhost(or your configured port).
Configuration
- Custom Apache configuration can be mounted at
/usr/local/apache2/conf/httpd.conf - SSL certificates can be mounted at
/usr/local/apache2/conf/ssl/ - Web content should be placed in the
htdocsdirectory
Security Notes
- The default configuration runs Apache as the
www-datauser for security - Consider using SSL/TLS certificates for production deployments
- Regularly update the Apache version to get security patches