Files
flux-web/nginx.conf.example
2026-01-22 18:31:30 +08:00

51 lines
1.3 KiB
Plaintext
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.

# flux-web Nginx 配置示例
#
# 使用方法:
# 1. 将下面配置复制到 /etc/nginx/sites-available/flux-web
# 2. 修改 server_name你的域名和 root项目路径
# 3. 执行ln -s /etc/nginx/sites-available/flux-web /etc/nginx/sites-enabled/
# 4. 测试nginx -t
# 5. 重载systemctl reload nginx
server {
listen 80;
server_name your-domain.com; # ← 改成你的域名
root /var/www/flux-web; # ← 改成项目路径
index index.html;
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 30d;
}
# 主路由
location / {
try_files $uri $uri/ /index.html;
}
}
# HTTPS 配置(可选,使用 Let's Encrypt 免费证书)
# 先执行apt install certbot python3-certbot-nginx
# 然后执行certbot --nginx -d your-domain.com
# 完整 HTTPS 配置示例:
#
# server {
# listen 443 ssl;
# server_name your-domain.com;
# root /var/www/flux-web;
# index index.html;
#
# ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
#
# location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
# expires 30d;
# }
#
# location / {
# try_files $uri $uri/ /index.html;
# }
# }