我遵循文档running grafana behind proxy和installing grafana using docker,并使用以下命令,使用官方docker启动Grafana:
docker run -itd -p 3000:3000 \
--name=grafana \
-v ~/grafana_storage:/var/lib/grafana \
-e "GF_SERVER_DOMAIN=www.jijunxu.cn" \
-e "GF_SERVER_ROOT_URL=https://www.jijunxu.cn/grafana/" \
--rm grafana/grafana
和nginx.conf:
location /grafana/
{
proxy_pass http://localhost:3000/;
}
但是访问https://www.jijunxu.cn/grafana/时我得到了此页面:
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: npm run dev, npm run watch, or npm run build
4. Sometimes restarting grafana-server can help
以及CSS和JS文件上的404。我已经尝试了所有这些方法,但是仍然保持不变。那么我的nginx.conf或docker命令有什么问题吗?
答案 0 :(得分:1)
我认为应该将环境变量GF_SERVER_DOMAIN
设置为其默认值localhost
,因为它托管在容器内,而不是在您的计算机上。
也就是说,删除-e "GF_SERVER_DOMAIN=www.jijunxu.cn"
应该可以。