# 配置 80端口
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
# 服务名
server_name xxx;
# 重定向到https
location / {
return 301 https://$host$request_uri;
}
}
# 配置443端口
server {
listen 443 ssl;
# 上传的两个证书文件的路径
ssl_certificate 你的SSL证书.crt;
ssl_certificate_key 你的SSL证书.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
client_max_body_size 200M;
# 配置https服务默认路径 此处根据自己的服务而定
location / {
proxy_pass http://127.0.0.1:你的web端口;
}
}
Nginx+Django配置SSL HttPS
于 2024-04-06 23:59:35 首次发布