0

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.

0

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;
  }
}
  • Thank you! I had managed to make this work few weeks ago and did pretty much what you have suggested here. I will mark as the right answer. – Amjad Mar 12 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.