Files
LokiStack/docs/deployment/host-nginx.md
T
logan 9f7c522157 feat: K8s 部署清单、Token 接入加固与日志/设置页优化
- kubernetes/: 30Gi PVC、单副本 Recreate、Secret/Service/NodePort/Ingress 清单与部署文档
- 数据安全: kubeconfig/token 统一加密存储,启动迁移历史明文,DB 0600
- Token 接入: 命名空间级最小权限提示、长期 Token、自签证书 TLS 兼容
- 部署: 命名空间级 Token 下跳过 Namespace patch/枚举,节点信息容错
- 日志页: namespace → app → pod 选择顺序与作用域收窄
- 设置页: 拆分为通用/告警/LDAP/镜像源四个 tab
- 弹框: 统一 max-h 滚动与长命令换行,修复内容溢出
2026-10-25 23:44:07 +08:00

70 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 主机部署:nginx 反代
适用于 `docker compose` 单机部署。平台监听 `127.0.0.1:8081`(或容器映射端口),由主机 nginx 对外提供 HTTP/HTTPS。
> 域名、IP 已脱敏;实际使用时替换为你的值。
## nginx vhost
`/etc/nginx/conf.d/opsx-loki.xxx.io.conf`:
```nginx
server {
listen 80;
server_name opsx-loki.xxx.io;
access_log /var/log/nginx/opsx-loki.xxx.io_access.log main;
error_log /var/log/nginx/opsx-loki.xxx.io_error.log;
location / {
proxy_pass http://127.0.0.1:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
client_max_body_size 100m;
}
}
```
## 前置 WAF / SLB 时(可选)
WAF 会把源 IP 改写为内网地址,需要在 `nginx.conf` 的 `http {}` 中还原真实客户端 IP,否则白名单会失效:
```nginx
set_real_ip_from 192.168.x.x; # WAF 回源地址
real_ip_header X-Forwarded-For;
```
## 内网白名单(可选)
建议统一放在 `/etc/nginx/nginx.conf` 的 `http {}`,不要散落在各 vhost(vhost 内一旦出现 `allow/deny` 会切断继承):
```nginx
allow 192.168.0.0/16;
allow 203.0.113.10; # 办公/跳板机出口
deny all;
```
公网站点单独在其 vhost 内写 `allow all;`。
## 生效
```bash
nginx -t && nginx -s reload
```
## 验证
```bash
curl -I -H "Host: opsx-loki.xxx.io" http://127.0.0.1/
curl -s -X POST http://opsx-loki.xxx.io/api/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"<你的密码>"}'
```