Skip to main content

Running web server along side Grafana with reverse proxy [Resolved]

I followed these steps below to setup Grafana on Ubuntu 18.04 https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-grafana-on-ubuntu-16-04

One of the steps is to setup reverse proxy and load port 3000 for Grafana by default which is nice. However, I wish to load some php pages as well on the web server port (https only) maybe using a sub domain or custom port?

How can I do this? I’m not very familiar with the nginx hosts file as I’m used to Apache. Any help will be appreciated.

Grafana loads on: https://grafana.mysite.com reverse proxy load to port 3000

So: Web server (html folder) should load on

https://manage.grafana.mysite.com or https://grafana.mysite.com:1234 (custom port)

Thanks.


Question Credit: Amjad
Question Reference
Asked March 13, 2019
Posted Under: Network
10 views
1 Answers

You can setup another virtual host with a new domain e.g.:

server {
    listen       443;
    server_name  manage.grafana.mysite.com;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}

TO setup an nginx webserver with php, you must install php-fpm. For Ubuntu you must run:

apt install php-fpm

Please check, that php-fpm service is running. If you're running php 7.0 you can change your vhost config with the php-fpm path e.g.:

server {
  listen       443;
  server_name  manage.grafana.mysite.com;

  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm index.php;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  }
}

credit: Giuliano Schindler
Answered March 13, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA