spark-server/deploy/nginx/host/sparkapi.conf
DESKTOP-L8OUL9F\gfl0034 b10c5d63a3 feat(brand): 三站替换四色火焰 logo 与 favicon
官网/docs 嵌入新品牌图;sparkapi nginx 可在未重建镜像时提供 /favicon.ico 与页头 logo。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-24 10:25:44 +08:00

100 lines
3.1 KiB
Plaintext

# Spark HTTP — sparkapi.wyrs365.com
# Public :443 is stream ssl_preread (see stream.d/spark-sni.conf).
# This vhost terminates TLS on loopback :8443 (PROXY protocol from stream).
upstream spark_http {
server 127.0.0.1:18080;
keepalive 16;
}
server {
listen 80;
listen [::]:80;
server_name sparkapi.wyrs365.com;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 80;
listen [::]:80;
server_name sparkim.wyrs365.com;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 404;
}
}
server {
listen 127.0.0.1:8443 ssl proxy_protocol;
listen [::1]:8443 ssl proxy_protocol;
http2 on;
server_name sparkapi.wyrs365.com;
ssl_certificate /etc/letsencrypt/live/sparkapi.wyrs365.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/sparkapi.wyrs365.com/privkey.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SparkSSL:10m;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options nosniff always;
client_max_body_size 32m;
proxy_connect_timeout 5s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_http_version 1.1;
proxy_set_header Connection "";
location /readyz {
allow 127.0.0.1;
allow ::1;
deny all;
proxy_pass http://spark_http;
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 https;
}
# Brand icons (no app rebuild required)
location = /favicon.ico {
alias /var/www/sparkapi-brand/favicon.ico;
add_header Cache-Control "public, max-age=604800";
access_log off;
}
location = /apple-touch-icon.png {
alias /var/www/sparkapi-brand/apple-touch-icon.png;
add_header Cache-Control "public, max-age=604800";
access_log off;
}
location ^~ /brand/ {
alias /var/www/sparkapi-brand/;
add_header Cache-Control "public, max-age=604800";
access_log off;
}
location / {
proxy_pass http://spark_http;
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 https;
# Inject favicon + header logo until next spark-server image ships docs HTML.
sub_filter_once off;
sub_filter_types text/html;
sub_filter '<head>' '<head><link rel="icon" href="/favicon.ico?v=20260924-flames" sizes="any"/><link rel="apple-touch-icon" href="/apple-touch-icon.png?v=20260924-flames"/>';
sub_filter '<strong>Spark IM</strong>' '<a href="/docs" style="display:inline-flex;align-items:center;gap:8px;color:inherit;text-decoration:none"><img src="/brand/logo.png?v=20260924-flames" width="28" height="28" alt="" style="border-radius:6px"/><strong>Spark IM</strong></a>';
}
}