Dish_Recognition/dish_server/nginx.https.example.conf

37 lines
1.1 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.

# 示例:用 Nginx 给 dish_server 提供 HTTPS,解决管理系统混合内容拦截。
#
# 前提:
# 1. 有域名解析到 116.147.40.47(推荐,可用 Let's Encrypt)
# 2. 云上 dish_server 仍监听 127.0.0.1:9100 或 0.0.0.0:9100
# 3. 安全组放行 80/443
#
# 证书申请(有域名时):
# certbot --nginx -d media.your-domain.com
#
# dish_server/.env 中改为:
# DISH_MEDIA_PUBLIC_BASE=https://media.your-domain.com/media
server {
listen 80;
server_name media.your-domain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name media.your-domain.com;
ssl_certificate /etc/letsencrypt/live/media.your-domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/media.your-domain.com/privkey.pem;
client_max_body_size 20m;
location / {
proxy_pass http://127.0.0.1:9100;
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;
}
}