Airflow + Nginx 设置给 Airflow 404 = 很多圈子 [英] Airflow + Nginx set up gives Airflow 404 = lots of circles
问题描述
我正在尝试使用此处给出的说明在 nginx 后面设置 Airflow.
I'm trying to set up Airflow behind nginx, using the instructions given here.
airflow.cfg 文件
base_url = https://myorg.com/airflow
web_server_port = 8081
.
.
.
enable_proxy_fix = True
nginx 配置
server {
listen 443 ssl http2 default_server;
server_name myorg.com;
.
.
.
location /airflow {
proxy_pass http://localhost:8081;
proxy_set_header Host $host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto "https";
}
}
Airflow 网络服务器和调度程序已作为 systemd 启动并运行.当我尝试访问 https://myorg.com/airflow/ 时,它给 Airflow 404 = 很多圈子.
Airflow webserver and scheduler are up and running as systemd. When I try to access https://myorg.com/airflow/, it gives Airflow 404 = lots of circles.
可能有什么问题?非常感谢您帮助实现此功能.
What could be wrong? Really appreciate your help in getting this running.
推荐答案
我刚刚遇到了同样的问题,并通过向位置添加拖尾 /
来修复它:location/airflow/{
而不是 location/airflow {
.尾部反斜杠告诉 nginx 删除 uri 路径中前面的/airflow 到相应的 python 应用程序.
I just had the same problem and fixed it by adding a tailing /
to the location: location /airflow/ {
instead of location /airflow {
. The tailing backslash tells nginx to remove the preceeding /airflow in uri paths to the corresponding python app.
我的整体配置如下:
server_name my_server.my_org.net;
location /airflow/ {
proxy_pass http://localhost:9997;
proxy_set_header Host $host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
在 airflow.cfg
中我另外指定:
base_url = http://my_server.my_org.net/airflow
enable_proxy_fix = False # Seems to be deprecated?
web_server_port = 9997
这篇关于Airflow + Nginx 设置给 Airflow 404 = 很多圈子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!