gpt4 book ai didi

uwsgi - 如何使用 uWSGI 内部路由将 HTTP 重定向到 HTTPS?

转载 作者:行者123 更新时间:2023-12-01 03:13:25 26 4
gpt4 key购买 nike

我已经使用 uWSGI 部署了一个 WSGI 应用程序,但是 I am not using NGINX .如何使用 uWSGI's internal routinghttp 请求重定向到 https?

我已经尝试过 uwsgi --route-uri="^http:\/\/(.+)$ redirect-permanent:https://\$1" 但是从 uWSGI 得到了一个错误: 无法识别的选项 '--route-uri=^https:\/\/(.+)$ redirect-permanent:https://\$1'

最佳答案

要将 http 重定向到 https,请使用以下配置:

[uwsgi]
; privileged port can only be opened as shared socket
shared-socket = 0.0.0.0:80
shared-socket = 0.0.0.0:443

;enable redirect to https
http-to-https = =0

; enable https, spdy is optional
https2 = addr==1,cert=server.crt,key=server.key,spdy=1
; alternative
; https = =1,server.crt,server.key

; force change of user after binding to ports as root
uid = user
gid = usergroup

; where original app will be running on IP or UNIX socket
socket = 127.0.0.1:8001

module = smthg.wsgi

关于uwsgi - 如何使用 uWSGI 内部路由将 HTTP 重定向到 HTTPS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33682770/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com