宝塔面板安装的nginx配置路径
nginx.conf文件路径:/www/server/nginx/conf/nginx.conf
多域名Nginx配置文件:/www/server/panel/vhost/nginx/你的域名.conf
将nginx域名配置文件你的域名.conf修改为
server { listen 80; listen 443 ssl http2; server_name 你的域名; index index.php index.html index.htm default.php default.htm default.html; root /www/wwwroot/你的域名(宝塔生成的html文件); #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则 #error_page 404/404.html; ssl_certificate /etc/letsencrypt/live/你的域名/fullchain.pem;#此处不用修改 ssl_certificate_key /etc/letsencrypt/live/你的域名/privkey.pem;#此处不用修改 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; error_page 497 https://$host$request_uri; #下面是添加的代码 location /api { proxy_pass http://127.0.0.1:8088/; } }
修改完后保存重启nginx
访问https://你的域名/api后的路由都会转到flask项目中(此处flask项目用的是8088端口)
设置nginx反向代理flask项目实现flask项目https请求
原文:https://www.cnblogs.com/Strangers/p/12304813.html