nginx gunicorn flask configuration
Now I map the /demo route to port 8088, how to rewrite the route
server {
listen 80;
server_name my_server;
location /demo {
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8088;
rewrite ^/demo/(.*)$ / last;
}
}
But if I write it like this, localhost/demo still doesn’t work, what should I do?
Visit
my_server/demo
and try?changed to
Data sources inlast
会对server
块重新发起请求,break
则使用当前location
If you say you want
If, you may need to do this:
But this can be processed directly in your background program, because the result is that accessing /demo/xx has the same effect as accessing /xx