feat: add more services
This commit is contained in:
54
src/nginx/README.md
Normal file
54
src/nginx/README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Nginx
|
||||
|
||||
[English](./README.md) | [中文](./README.zh.md)
|
||||
|
||||
This service deploys Nginx, a high-performance web server and reverse proxy server.
|
||||
|
||||
## Services
|
||||
|
||||
- `nginx`: The Nginx web server service.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable Name | Description | Default Value |
|
||||
| ------------------------- | ---------------------------------------------- | ------------------- |
|
||||
| NGINX_VERSION | Nginx image version | `1.29.1-alpine3.20` |
|
||||
| NGINX_HTTP_PORT_OVERRIDE | Host port mapping for HTTP (maps to port 80) | 80 |
|
||||
| NGINX_HTTPS_PORT_OVERRIDE | Host port mapping for HTTPS (maps to port 443) | 443 |
|
||||
| NGINX_HOST | Server hostname for configuration | `localhost` |
|
||||
| NGINX_PORT | Server port for configuration | 80 |
|
||||
|
||||
Please modify the `.env` file as needed for your use case.
|
||||
|
||||
## Volumes
|
||||
|
||||
- `nginx_logs`: A volume for storing Nginx logs.
|
||||
- `./html`: Directory for web content (mounted as read-only).
|
||||
- `./nginx.conf`: Optional custom Nginx configuration file.
|
||||
- `./conf.d`: Optional directory for additional configuration files.
|
||||
- `./ssl`: Optional SSL certificates directory.
|
||||
|
||||
## Usage
|
||||
|
||||
1. The `html` directory is already created with a default `index.html` file.
|
||||
|
||||
2. Start the service:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. Access the web server at `http://localhost` (or your configured port).
|
||||
|
||||
## Configuration
|
||||
|
||||
- Custom Nginx configuration can be mounted at `/etc/nginx/nginx.conf`
|
||||
- Additional server configurations can be placed in the `conf.d` directory
|
||||
- SSL certificates can be mounted at `/etc/nginx/ssl/`
|
||||
- Web content should be placed in the `html` directory
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Consider using SSL/TLS certificates for production deployments
|
||||
- Regularly update the Nginx version to get security patches
|
||||
- Review and customize the Nginx configuration for your specific needs
|
||||
54
src/nginx/README.zh.md
Normal file
54
src/nginx/README.zh.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Nginx
|
||||
|
||||
[English](./README.md) | [中文](./README.zh.md)
|
||||
|
||||
此服务部署 Nginx,一个高性能的 Web 服务器和反向代理服务器。
|
||||
|
||||
## 服务
|
||||
|
||||
- `nginx`:Nginx Web 服务器服务。
|
||||
|
||||
## 环境变量
|
||||
|
||||
| 变量名 | 描述 | 默认值 |
|
||||
| ------------------------- | ------------------------------------ | ------------------- |
|
||||
| NGINX_VERSION | Nginx 镜像版本 | `1.29.1-alpine3.20` |
|
||||
| NGINX_HTTP_PORT_OVERRIDE | HTTP 主机端口映射(映射到端口 80) | 80 |
|
||||
| NGINX_HTTPS_PORT_OVERRIDE | HTTPS 主机端口映射(映射到端口 443) | 443 |
|
||||
| NGINX_HOST | 配置的服务器主机名 | `localhost` |
|
||||
| NGINX_PORT | 配置的服务器端口 | 80 |
|
||||
|
||||
请根据您的使用情况修改 `.env` 文件。
|
||||
|
||||
## 卷
|
||||
|
||||
- `nginx_logs`:用于存储 Nginx 日志的卷。
|
||||
- `./html`:Web 内容目录(以只读方式挂载)。
|
||||
- `./nginx.conf`:可选的自定义 Nginx 配置文件。
|
||||
- `./conf.d`:可选的附加配置文件目录。
|
||||
- `./ssl`:可选的 SSL 证书目录。
|
||||
|
||||
## 使用方法
|
||||
|
||||
1. `html` 目录已创建并包含默认的 `index.html` 文件。
|
||||
|
||||
2. 启动服务:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. 在 `http://localhost`(或您配置的端口)访问 Web 服务器。
|
||||
|
||||
## 配置
|
||||
|
||||
- 自定义 Nginx 配置可以挂载到 `/etc/nginx/nginx.conf`
|
||||
- 附加服务器配置可以放置在 `conf.d` 目录中
|
||||
- SSL 证书可以挂载到 `/etc/nginx/ssl/`
|
||||
- Web 内容应放置在 `html` 目录中
|
||||
|
||||
## 安全注意事项
|
||||
|
||||
- 生产环境部署时考虑使用 SSL/TLS 证书
|
||||
- 定期更新 Nginx 版本以获取安全补丁
|
||||
- 根据您的具体需求审查和自定义 Nginx 配置
|
||||
42
src/nginx/docker-compose.yaml
Normal file
42
src/nginx/docker-compose.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
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:
|
||||
nginx:
|
||||
<<: *default
|
||||
image: nginx:${NGINX_VERSION:-1.29.1-alpine3.20}
|
||||
container_name: nginx
|
||||
ports:
|
||||
- "${NGINX_HTTP_PORT_OVERRIDE:-80}:80"
|
||||
- "${NGINX_HTTPS_PORT_OVERRIDE:-443}:443"
|
||||
volumes:
|
||||
- *localtime
|
||||
- *timezone
|
||||
- nginx_logs:/var/log/nginx
|
||||
- ./html:/usr/share/nginx/html:ro
|
||||
|
||||
# Custom configuration
|
||||
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
# - ./conf.d:/etc/nginx/conf.d:ro
|
||||
# - ./ssl:/etc/nginx/ssl:ro
|
||||
environment:
|
||||
- NGINX_HOST=${NGINX_HOST:-localhost}
|
||||
- NGINX_PORT=${NGINX_PORT:-80}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: '0.25'
|
||||
memory: 64M
|
||||
|
||||
volumes:
|
||||
nginx_logs:
|
||||
12
src/nginx/html/index.html
Normal file
12
src/nginx/html/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Nginx</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to Nginx</h1>
|
||||
<p>If you can see this page, the nginx web server is successfully installed and working.</p>
|
||||
<p>This is the default page provided by the compose-anything project.</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user