
11notes/nginx!size!5px!version!5px!pulls!5px[]([***]
Nginx,轻量级且无发行版,可用于反向代理后端或作为完整版本的代理服务器。
nginx(engine x)是一款HTTP Web服务器、反向代理、内容缓存、负载均衡器、TCP/UDP代理服务器及邮件代理服务器。
我能用它做什么? 该镜像可作为需要高性能Web服务器的Nginx相关镜像基础。默认标签版本移除了反向代理可提供的大部分功能,但保留了重要的Web服务器功能(如brotli压缩)。默认标签版本不适合作为反向代理运行,如需此功能请使用完整版本。例如,默认标签版本不支持HTTPS!
为什么我应该使用此镜像而非其他现有镜像? 这是个好问题!因为...
如果您重视安全性、简洁性和极致优化,此镜像可能适合您。
以下是本镜像与其他常用/官方镜像的对比:
| 镜像 | 磁盘大小 | 默认用户 | 无发行版 | 支持架构 |
|---|---|---|---|---|
| 11notes/nginx:1.28.0 | 3MB | 1000:1000 | ✅ | armv7, amd64, arm64 |
| nginx:1.28.0 | 192MB | 0:0 | ❌ | amd64, armv5, armv7, arm64v8, 386, mips64le, ppc64le, s390x |
yamlworker_processes auto; worker_cpu_affinity auto; worker_rlimit_nofile 204800; error_log /nginx/log/error.log warn; daemon off; events { worker_connections 1024; use epoll; multi_accept on; } http { log_format main escape=json '{"log":"main","time":"$time_iso8601","server":{"name":"$server_name", "protocol":"$server_protocol"}, "client":{"ip":"$remote_addr", "x-forwarded-for":"$http_x_forwarded_for", "user":"$remote_user"},"request":{"method":"$request_method", "url":"$request_uri", "time":"$request_time", "status":$status}}'; log_format proxy escape=json '{"log":"proxy", "time":"$time_iso8601","server":{"name":"$server_name", "protocol":"$server_protocol"}}, "client":{"ip":"$remote_addr", "x-forwarded-for":"$http_x_forwarded_for", "user":"$remote_user"},"request":{"method":"$request_method", "url":"$request_uri", "time":"$request_time", "status":$status}, "proxy":{"host":"$upstream_addr", "time":{"connect":"$upstream_connect_time", "response":"$upstream_response_time", "header":"$upstream_header_time"}, "io":{"bytes":{"sent":"$upstream_bytes_sent", "received":"$upstream_bytes_received"}}, "cache":"$upstream_cache_status", "status":"$upstream_status"}}'; access_log off; server_tokens off; include mime.types; default_type application/octet-stream; sendfile on; aio on; tcp_nopush on; tcp_nodelay on; gzip on; brotli on; brotli_comp_level 4; brotli_static on; brotli_types text/plain text/css text/xml text/javascript text/x-component application/xml application/xml+rss application/javascript application/json application/atom+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype application/x-web-app-manifest+json application/xhtml+xml application/octet-stream font/opentype font/truetype font/eot font/otf image/svg+xml image/x-icon image/vnd.microsoft.icon image/bmp; client_max_body_size 8M; keepalive_timeout 90; keepalive_requests ***; reset_timedout_connection on; client_body_timeout 10; send_timeout 5; open_file_cache max=204800 inactive=5m; open_file_cache_valid 2m; open_file_cache_min_uses 2; open_file_cache_errors off; root /nginx/var; include /nginx/etc/*.conf; }
默认配置不含特殊设置,启用了brotli压缩,将工作进程数设置为可用CPU核心数,提供两种默认日志格式,禁用了非必要功能,并启用了最佳性能设置。如需修改Nginx配置,请挂载自定义配置文件。
.conf结尾yamlname: "nginx" services: nginx: image: "11notes/nginx:1.28.0" read_only: true environment: TZ: "Europe/Zurich" ports: - "3000:3000/tcp" networks: frontend: volumes: - "etc:/nginx/etc" - "var:/nginx/var" tmpfs: - "/nginx/cache:uid=1000,gid=1000" - "/nginx/run:uid=1000,gid=1000" restart: "always" volumes: etc: var: networks: frontend:
| 参数 | 值 | 描述 |
|---|---|---|
user | docker | 用户名 |
uid | 1000 | 用户标识符 |
gid | 1000 | 组标识符 |
home | /nginx | docker用户的主目录 |
| 参数 | 说明 | 默认值 |
|---|---|---|
TZ | 时区 | 无 |
DEBUG | 启用容器镜像和应用的调试模式(如支持) | 无 |
以下是镜像的主要标签。此外,每个提交及其简写sha256值也对应一个标签。
我认为:latest标签存在风险。我曾多次对镜像引入破坏性变更,这可能会给部分用户带来问题。如果您不想将标签更新至最新语义化版本,可使用语义化版本的短版本号。例如,无需使用:1.28.0,可使用:1或:1.28。由于这些标签会随新版本自动更新,使用它们与使用:latest类似,但至少固定在主版本或次版本级别。
如果您仍坚持使用最新版本,可使用:rolling标签,但请注意!这将直接获取应用的最新版本,无论是否存在破坏性变更或安全问题,风险自负!
docker pull 11notes/nginx:1.28.0 docker pull ghcr.io/11notes/nginx:1.28.0 docker pull quay.io/11notes/nginx:1.28.0
此镜像不基于其他镜像,而是以scratch为基础层构建。包含以下无发行版层:
此镜像仅供您自行承担风险使用。更新镜像版本前请务必备份。查看发布说明了解破坏性变更。如使用中遇到问题,请提交issue。如有疑问或建议,请创建讨论而非issue。您可在GitHub查看我的所有其他仓库。
创建于 02.09.2025, 01:45:08 (CET)

manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务