我是Nginx的新手。我想使用flask创建一个身份验证服务器。我的想法是在用户登陆我的主页时将其重定向到我的flask端口:5000。验证后,它们将被重定向到内部站点(另一个端口)
我做了以下
conf.d / default.conf
server {
listen 80;
location / {
root ..
index ..
proxy_pass http://localhost:5000;
}
}
并尝试了以下方法
server {
listen 80;
location / {
root ..
index ..
proxy_pass http://localhost/auth;
}
location /auth {
internal;
proxy_pass http://localhost:<another port>;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}