首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >旧Domain的Grafana代理新域

旧Domain的Grafana代理新域
EN

Stack Overflow用户
提问于 2021-04-16 00:49:59
回答 1查看 111关注 0票数 0

我目前运行的是Grafana服务器,前面有一台NGINX服务器,从我的grafana.olddomain.uk上运行:

代码语言:javascript
复制
location / {
    proxy_pass         http://127.0.0.1:3000;
}

我想从我的新域(https://my.newdomain/grafana)代理到旧域,但遇到了配置问题:

代码语言:javascript
复制
location /grafana {
  max_ranges 0;
  rewrite ^/grafana/(.*)$  /$1  break;
  proxy_pass https://grafana.olddomain.uk/;
  proxy_ssl_server_name on;
  proxy_ssl_trusted_certificate /etc/nginx/conf.d/trusted_ca_cert.pem;
  proxy_set_header Host $host;
}

这是抛出一个错误,清除了Grafana的服务:

代码语言:javascript
复制
If you're seeing this Grafana has failed to load its application files

1. This could be caused by your reverse proxy settings.
2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath
3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build
4. Sometimes restarting grafana-server can help

所以这似乎很清楚,我现在正在使用子文件夹,需要更改grafana.ini,但这将破坏grafana.olddomain.uk。

在我的新域位置中,我需要什么才能使其正常工作?

编辑:来自https://my.newdomain.uk/grafana的curl响应(以下重定向)

代码语言:javascript
复制
> GET /grafana HTTP/1.1
> Host: my.newdomain.uk
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx
< Date: Fri, 16 Apr 2021 17:39:13 GMT
< Content-Type: text/html
< Content-Length: 162
< Location: https://my.newdomain.uk/grafana/
< Connection: keep-alive
<
> GET /grafana/ HTTP/1.1
> Host: my.newdomain.uk
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Server: nginx
< Date: Fri, 16 Apr 2021 17:39:13 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: no-cache
< Expires: -1
< Pragma: no-cache
< X-Frame-Options: deny
<
EN

回答 1

Stack Overflow用户

发布于 2021-04-21 23:31:00

因此,在多次尝试使子路径正常工作后,我不得不放弃并将其设置在root上。这需要将所有配置拆分到单独的站点中。

代码语言:javascript
复制
location / {
  max_ranges 0;
  proxy_pass https://grafana.olddomain.uk/;
  proxy_ssl_server_name on;
  proxy_ssl_trusted_certificate /etc/nginx/conf.d/trusted_ca_cert.pem;
  proxy_set_header Host $host;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67112677

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档