[英]Error displaying Swagger UI of flask-restx in Deployment using uwsgi and nginx
[英]How to host flask-restx swagger UI using nginx reverse proxy
我嘗試了多種方法來修復反向代理,但沒有得到任何運氣。 我按照下面的 url 解決了這個問題: https://github.com/noirbizarre/flask-restplus/issues/223
nginx 配置如下:
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /api {
proxy_pass http://localhost:5000; #change to your port
proxy_redirect off;
proxy_set_header Host $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;
}
向 api 添加重寫子句
rewrite ^/api/(.*) /$1 break;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.