1

I am reading through the official Grafana behind a reverse proxy documentation, but I still cannot get to see the result and I don't know why.

Here is what I did:

I added the following two type A DNS records, which direct to my server and have TTL of 3600.

  • www.grafana.mysite.com
  • grafana.mysite.com

I created the following file /etc/nginx/sites-available/grafana.mysite.com

Inside, the file looks like so:

server {
  listen 80;
  root /usr/share/nginx/www;
  index index.html index.htm;

  location / {
   proxy_pass http://localhost:3000/;
  }
}

The I modified in /etc/grafana/grafana.ini

[server]
domain = grafana.mysite.com

After that tested nginx's syntax sudo nginx -t and restarted the grafana server and the nginx server like so:

  1. sudo systemctl restart grafana-server
  2. sudo systemctl reload nginx

Yet when I go to either grafana.mysite.com or www.grafana.mysite.com I see the Welcome to nginx! page only :/

Can someone help me fix this issue?

Newskooler
  • 157
  • 1
  • 1
  • 10
  • 2
    Are you sure that the file you created is being read by Nginx? Try: `nginx -T` (uppercase `T`) to view the entire configuration that Nginx is using. Is this file symlinked to the `sites-enabled` directory? – Richard Smith Oct 19 '19 at 10:02
  • A good point from @RichardSmith, one more thing to check is if there is any other (e.g. default) server configured. I would suggest to add name-based virtual host https://www.tecmint.com/nginx-name-based-and-ip-based-virtual-hosts-server-blocks/ - the server_name grafana.mysite.com www.grafana.mysite.com; directive if the issue is not solved by linking the configuration to a proper place. – Petr Chloupek Oct 19 '19 at 10:04
  • @RichardSmith indeed it is not symlinked... – Newskooler Oct 19 '19 at 10:09
  • @RichardSmith after symlinking it, I get `404 Not Found` on the webpage. Any idea why? and in my terminal I get `channel 7: open failed: connect failed: Connection refused` – Newskooler Oct 19 '19 at 10:13

0 Answers0