server {
server_name cehuayun.cn;
include /www/server/panel/vhost/nginx/extension/cehuayun.cn/*.conf;
# SSL证书路径(替换为您的实际路径)
# SSL强化配置
# 静态文件
location /static/ {
alias /wedding/static/;
}
# HTTP/HTTPS代理
location / {
proxy_pass http://daphne_backend;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
# WebSocket代理
location /ws/ {
proxy_pass http://daphne_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
server {
listen 80;
server_name cehuayun.cn;
include /www/server/panel/vhost/nginx/extension/cehuayun.cn/*.conf;
return 301 https://$host$request_uri;
}
upstream daphne_backend {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
} |