feat: add more services
This commit is contained in:
62
src/apache/README.md
Normal file
62
src/apache/README.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Apache HTTP Server
|
||||
|
||||
[English](./README.md) | [中文](./README.zh.md)
|
||||
|
||||
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
|
||||
|
||||
1. Create the service directory structure:
|
||||
|
||||
```bash
|
||||
mkdir -p htdocs
|
||||
```
|
||||
|
||||
2. Add your web content to the `htdocs` directory:
|
||||
|
||||
```bash
|
||||
echo "<h1>Hello World</h1>" > htdocs/index.html
|
||||
```
|
||||
|
||||
3. Start the service:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. 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 `htdocs` directory
|
||||
|
||||
## Security Notes
|
||||
|
||||
- The default configuration runs Apache as the `www-data` user for security
|
||||
- Consider using SSL/TLS certificates for production deployments
|
||||
- Regularly update the Apache version to get security patches
|
||||
62
src/apache/README.zh.md
Normal file
62
src/apache/README.zh.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Apache HTTP 服务器
|
||||
|
||||
[English](./README.md) | [中文](./README.zh.md)
|
||||
|
||||
此服务部署 Apache HTTP 服务器,一个流行的开源 Web 服务器。
|
||||
|
||||
## 服务
|
||||
|
||||
- `apache`:Apache HTTP 服务器服务。
|
||||
|
||||
## 环境变量
|
||||
|
||||
| 变量名 | 描述 | 默认值 |
|
||||
| -------------------------- | ------------------------------------ | ------------------- |
|
||||
| APACHE_VERSION | Apache HTTP 服务器镜像版本 | `2.4.62-alpine3.20` |
|
||||
| APACHE_HTTP_PORT_OVERRIDE | HTTP 主机端口映射(映射到端口 80) | 80 |
|
||||
| APACHE_HTTPS_PORT_OVERRIDE | HTTPS 主机端口映射(映射到端口 443) | 443 |
|
||||
| APACHE_RUN_USER | 运行 Apache 的用户 | `www-data` |
|
||||
| APACHE_RUN_GROUP | 运行 Apache 的组 | `www-data` |
|
||||
|
||||
请根据您的使用情况修改 `.env` 文件。
|
||||
|
||||
## 卷
|
||||
|
||||
- `apache_logs`:用于存储 Apache 日志的卷。
|
||||
- `./htdocs`:Web 内容目录(以只读方式挂载)。
|
||||
- `./httpd.conf`:可选的自定义 Apache 配置文件。
|
||||
- `./ssl`:可选的 SSL 证书目录。
|
||||
|
||||
## 使用方法
|
||||
|
||||
1. 创建服务目录结构:
|
||||
|
||||
```bash
|
||||
mkdir -p htdocs
|
||||
```
|
||||
|
||||
2. 将您的 Web 内容添加到 `htdocs` 目录:
|
||||
|
||||
```bash
|
||||
echo "<h1>Hello World</h1>" > htdocs/index.html
|
||||
```
|
||||
|
||||
3. 启动服务:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4. 在 `http://localhost`(或您配置的端口)访问 Web 服务器。
|
||||
|
||||
## 配置
|
||||
|
||||
- 自定义 Apache 配置可以挂载到 `/usr/local/apache2/conf/httpd.conf`
|
||||
- SSL 证书可以挂载到 `/usr/local/apache2/conf/ssl/`
|
||||
- Web 内容应放置在 `htdocs` 目录中
|
||||
|
||||
## 安全注意事项
|
||||
|
||||
- 默认配置以 `www-data` 用户身份运行 Apache 以确保安全
|
||||
- 生产环境部署时考虑使用 SSL/TLS 证书
|
||||
- 定期更新 Apache 版本以获取安全补丁
|
||||
41
src/apache/docker-compose.yaml
Normal file
41
src/apache/docker-compose.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
x-default: &default
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- &localtime /etc/localtime:/etc/localtime:ro
|
||||
- &timezone /etc/timezone:/etc/timezone:ro
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
|
||||
services:
|
||||
apache:
|
||||
<<: *default
|
||||
image: httpd:${APACHE_VERSION:-2.4.62-alpine3.20}
|
||||
container_name: apache
|
||||
ports:
|
||||
- "${APACHE_HTTP_PORT_OVERRIDE:-80}:80"
|
||||
- "${APACHE_HTTPS_PORT_OVERRIDE:-443}:443"
|
||||
volumes:
|
||||
- *localtime
|
||||
- *timezone
|
||||
- apache_logs:/usr/local/apache2/logs
|
||||
- ./htdocs:/usr/local/apache2/htdocs:ro
|
||||
|
||||
# Custom configuration
|
||||
# - ./httpd.conf:/usr/local/apache2/conf/httpd.conf:ro
|
||||
# - ./ssl:/usr/local/apache2/conf/ssl:ro
|
||||
environment:
|
||||
- APACHE_RUN_USER=${APACHE_RUN_USER:-www-data}
|
||||
- APACHE_RUN_GROUP=${APACHE_RUN_GROUP:-www-data}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 128M
|
||||
|
||||
volumes:
|
||||
apache_logs:
|
||||
12
src/apache/htdocs/index.html
Normal file
12
src/apache/htdocs/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Apache HTTP Server</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to Apache HTTP Server</h1>
|
||||
<p>If you can see this page, the Apache HTTP server is working correctly.</p>
|
||||
<p>This is the default page provided by the compose-anything project.</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user