nginx - https 请求将发送到 80 端口
问题描述
我正在使用烧瓶 + nginx 对我的域的所有使用烧瓶的请求都将转到 80 端口,即使它是 https 连接我的域配置:
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:8000;
}
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSV1.2;
#ssl_dhparam /etc/nginx/dhparam.pem;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
所以,我发出重定向循环,在 access.log 中我看到,所有请求都将发送到 80 端口。我究竟做错了什么?证书来自 Let's Encrypt。
解决方案
推荐阅读
- powershell - 将 powershell 导出到 CSV 的问题
- c - 在C中将结构添加到结构链表中
- tfs - 是否可以在 DevOps 2019 的工作项 Web 布局的相应字段旁边显示标签?
- r - 构建运行长度的频率表
- c# - 带有文档数组的 MongoDB 建模
- javascript - 带有 @typescript-eslint/no-unsafe-* 规则的新 eslint 错误
- java - SAP Hybris 辅助服务模块 (ASM) - 双重登录
- apache-spark - 导入 Pyspark Delta Lake 模块时未找到模块错误
- python-3.x - Python 将 4 个元组的列表转换为三个 2 个元组,加入元组中的最后一个元素
- json - 使用环境变量生成字段并将它们插入到对象中