- lib/xlib/net.nix: domains.public/opencodes/internal/ad; все живые
хостнеймы выводятся из реестра (nginx, coredns, authelia, nextcloud,
gitea, vds, netbird, open-webui, opencode, nix-cache). Литералы — только
в комментариях/example/email/trusted-key и в БД панели.
- 3xui-domain-sync.service: before+wantedBy podman-3xui_app, идемпотентно
приводит settings.webDomain к host."3x-ui".certDomain ДО старта панели
(R1.19/инвариант 19); контейнер сам не перезапускает.
- config-fingerprint до/после: значения не изменились — 0 отличий на
rydiwo/atoridu/wsl, на sapphira/otreca только новый юнит и unitConfig.
- epral: убран nginx-mainline из strictModule (nix-on-droid не вычислялся
с 5712abb); в AGENTS.md исправлен вывод (build.activationPackage) и
добавлен --impure — T64 (проверить сборку на устройстве).
- .agent: закрыты T10/T49/T50/T54, добавлены T63 (done) и T64 (pending),
ADR-0012; phases в manifest.json синхронизированы с checkpoints.json.
82 lines
2.5 KiB
Nix
82 lines
2.5 KiB
Nix
{
|
|
config,
|
|
inputs,
|
|
pkgs,
|
|
xlib,
|
|
...
|
|
}:
|
|
# VDS nginx differs from server's in one key way: port 443 is owned
|
|
# by an nginx stream block that does SNI-based TCP routing, not by
|
|
# http { server {} } blocks. This lets a single host (pubray1.zeroq.su)
|
|
# serve both the 3x-ui panel and an Xray REALITY inbound over TLS,
|
|
# sharing the same port.
|
|
#
|
|
# Routing:
|
|
# pubray1.zeroq.su → 127.0.0.1:2049 (3x-ui panel; LE cert mounted
|
|
# into the container terminates TLS)
|
|
# anything else → 127.0.0.1:15380 (Xray REALITY: the `default` branch
|
|
# catches every other SNI, including whatever name a
|
|
# REALITY client sends. Xray sees its real configured
|
|
# port 443 via DNAT)
|
|
# default → 127.0.0.1:15380 (REALITY fallback for any
|
|
# other SNI / IP-direct)
|
|
#
|
|
# ssl_preread reads SNI from the ClientHello and forwards the rest of
|
|
# the TLS stream as-is, so Xray sees a real port-443 connection even
|
|
# though podman DNATs it via host:15380.
|
|
let
|
|
# Public name of the VDS host: the 3x-ui panel vhost and its SNI branch.
|
|
fqdn = name: "${name}.${xlib.net.domains.public}";
|
|
|
|
# Goes inside the auto-generated `stream {}` block (services.nginx.streamConfig).
|
|
# pubray1.zeroq.su → 3x-ui panel; everything else (including any SNI
|
|
# a REALITY client uses, e.g. media.mediavitrina.ru) → Xray.
|
|
streamConfig = ''
|
|
ssl_preread on;
|
|
|
|
map $ssl_preread_server_name $sni_backend {
|
|
default xray;
|
|
${fqdn "pubray1"} panel;
|
|
}
|
|
|
|
upstream panel {
|
|
server 127.0.0.1:2049;
|
|
}
|
|
|
|
upstream xray {
|
|
server 127.0.0.1:15380;
|
|
}
|
|
|
|
server {
|
|
listen 443;
|
|
proxy_pass $sni_backend;
|
|
proxy_timeout 600s;
|
|
proxy_connect_timeout 5s;
|
|
}
|
|
'';
|
|
in
|
|
{
|
|
users.users.nginx.extraGroups = [ "acme" ];
|
|
services.nginx = {
|
|
enable = true;
|
|
recommendedGzipSettings = true;
|
|
recommendedOptimisation = true;
|
|
recommendedProxySettings = true;
|
|
recommendedTlsSettings = true;
|
|
# ACME only — 443 is owned by the stream block, not by http { server {} }.
|
|
# Don't add forceSSL: it would generate an HTTPS server block that
|
|
# conflicts with the stream listener.
|
|
virtualHosts."${fqdn "pubray1"}".enableACME = true;
|
|
# Lands inside the auto-generated `stream {}` block.
|
|
streamConfig = streamConfig;
|
|
};
|
|
security.acme = {
|
|
acceptTerms = true;
|
|
defaults.email = "oqyude@gmail.com";
|
|
};
|
|
networking.firewall.allowedTCPPorts = [
|
|
80
|
|
443
|
|
];
|
|
}
|