QuestDB通过NGINX反向代理后出现「Not Found」问题求助
QuestDB Web GUI通过NGINX反向代理认证后显示「Not Found」问题
问题现象
- 运行QuestDB 6.6.1,按官方指引配置NGINX反向代理+基础认证
- 访问Web GUI时,登录弹窗正常,账号密码验证通过后,浏览器显示纯文本「Not Found」(非NGINX 403页面)
- 直接通过
<server.domain>:9000可正常访问QuestDB Web GUI - nginx.log与questdb.log无相关错误日志

相关配置文件
reverse_proxy.conf内容
server { listen 80 default_server; listen [::]:80 default_server; server_name server.domain; return 301 https://$host$request_uri; } server { listen 443 ssl; listen [::]:443 ssl; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; ssl_certificate <path>/nginx.crt; ssl_certificate_key <path>/nginx.key; root /var/www/server.domain/html; index index.html index.htm; server_name server.domain; location /location1 { proxy_pass https://localhost:port1; proxy_set_header Host $host; } location /location2 { proxy_pass http://localhost:port2/location2; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10M; } location = /questdb/ { auth_basic "Restricted QuestDB"; auth_basic_user_file <path>/.htpasswd; proxy_pass http://localhost:9000; proxy_set_header Host $host; proxy_read_timeout 300; proxy_connect_timeout 120; proxy_send_timeout 300; proxy_set_header Host $host; } }
nginx.conf内容
user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # For suppression of server version number server_tokens off; server_names_hash_bucket_size 64; include /etc/nginx/mime.types; default_type application/octet-stream; ## # SSL Settings ## ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; ## # Virtual Host Configs ## map_hash_max_size 262144; map_hash_bucket_size 262144; include /etc/nginx/conf.d/*.conf; }
问题原因及修复方案
核心问题
- 配置中使用
location = /questdb/精确匹配规则,仅能匹配/questdb/单一路径,但QuestDB Web GUI加载时会请求大量静态资源、API接口,这些请求无法匹配该location,导致返回「Not Found」。 proxy_pass未处理路径映射,访问/questdb/时,NGINX会转发到http://localhost:9000/questdb/,但QuestDB原生根路径为/,导致资源找不到。
修复步骤
- 修改QuestDB对应的location配置:
location /questdb/ { auth_basic "Restricted QuestDB"; auth_basic_user_file <path>/.htpasswd; proxy_pass http://localhost:9000/; proxy_set_header Host $host; proxy_read_timeout 300; proxy_connect_timeout 120; proxy_send_timeout 300; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
- 去掉
=符号,改为前缀匹配,覆盖所有/questdb/开头的请求 proxy_pass末尾添加/,将/questdb/xxx转发到http://localhost:9000/xxx,对应QuestDB原生路径
- 重新加载NGINX配置:
sudo nginx -s reload
修改后,QuestDB Web GUI的所有资源请求会被正确转发,认证后即可正常访问界面。
内容的提问来源于stack exchange,提问作者WolfiG
相关产品推荐
相关产品推荐

