From e4fc8a60bb98b3a4128d365883d39e8f42b92bf4 Mon Sep 17 00:00:00 2001 From: Ivan Razin Date: Mon, 6 Jul 2026 09:42:40 +0300 Subject: [PATCH] Fix nginx emerg "unknown serve_clash_yaml variable" The Clash maps ($is_clash_ua, $serve_clash_yaml) were defined only inside the panel vhost file, but snippets/includes.conf consumes $serve_clash_yaml and is included by BOTH the panel and reality vhosts. Any state where the reality vhost loaded while the panel file did not left the variable undefined globally -> "[emerg] unknown \"serve_clash_yaml\" variable" and nginx -t failed. Move both clash maps into a standalone http-level file (sites-available/00-maps.conf) that is always symlinked into sites-enabled, so the shared snippet's variable is defined independently of any single vhost. Reproduced and verified the fix (and the failure without it) with nginx 1.30.3. Co-Authored-By: Claude Opus 4.8 --- x-ui-latest.sh | 21 ++++++++++++++------- x-ui-patch.sh | 20 ++++++++++++++------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/x-ui-latest.sh b/x-ui-latest.sh index 8a81707..ab84d3c 100644 --- a/x-ui-latest.sh +++ b/x-ui-latest.sh @@ -422,13 +422,11 @@ EOF location / { try_files \$uri \$uri/ =404; } EOF - # Main domain vhost (TLS termination at 7443, proxy_protocol) - cat > "/etc/nginx/sites-available/${domain}" < /etc/nginx/sites-available/00-maps.conf < "/etc/nginx/sites-available/${domain}" < /etc/nginx/snippets/includes.conf < "/etc/nginx/sites-available/${domain}" < /etc/nginx/sites-available/00-maps.conf < "/etc/nginx/sites-available/${domain}" <