Would you like to learn how to configure Grafana HTTP authentication on Apache? In this tutorial, we are going to show you how to authenticate Grafana users using the Apache Native HTTP authentication.

• Ubuntu 18
• Ubuntu 19
• Grafana 6.4.4

Grafana Tutorial:

On this page, we offer quick access to a list of Grafana tutorials.

Tutorial – Grafana Installation

On the Linux console, use the following commands to install the MySQL database service.

Copy to Clipboard

Access the MySQL command-line.

Copy to Clipboard

Create a database named grafana.

Copy to Clipboard

Create a database user account named grafana.

Copy to Clipboard

Give the SQL user named grafana permission over the database named grafana.

Copy to Clipboard

On the Linux console, use the following commands to configure the Grafana APT repository.

Copy to Clipboard

Use the following command to install Grafana.

Copy to Clipboard

Edit the Grafana configuration file grafana.ini.

Copy to Clipboard

Perform the following configuration under the [Database] and [Session] sections.

Copy to Clipboard

Keep in mind that you need to change the MySQL username and password to reflect your environment.

Use the following command to start the Grafana service.

Copy to Clipboard

The Grafana service will start listening on TCP port 3000.

To test your Grafana installation, open your browser and enter the IP address of your server plus :3000.

In our example, the following URL was entered in the Browser:

• http://192.168.15.11:3000

The Grafana web interface should be presented.

grafana default password

On the prompt screen, enter the Grafana Default Password login information.

• Username: admin
• Password: admin

The system will ask you to change the Grafana default password.

Congratulations! You have finished the Grafana basic installation.

Tutorial Grafana – Apache Proxy Installation

Now, we need to install the Apache webserver and configure it to work as a Proxy to the Grafana service.

Install the Apache web server and the required packages.

Copy to Clipboard

Enable the required Apache modules.

Copy to Clipboard

Create the Apache password file and the first account named admin.

Copy to Clipboard

The system will ask you to enter the admin account password twice.

Copy to Clipboard

Now, let’s test the admin account password.

Copy to Clipboard

Enter the admin account password.

Copy to Clipboard

Use the following commands to add accounts to the Apache password file.

Copy to Clipboard

In our example, we add an account named benjamin.

Now, we need to configure Apache port 80 as a proxy to the Grafana service port 3000.

We also need to configure Apache to request authentication to users trying to acess Grafana.

Edit the Apache 000-default.conf configuration file.

Copy to Clipboard

Here is the 000-default.conf file before our configuration.

Copy to Clipboard

Here is the 000-default.conf file after our configuration.

Copy to Clipboard

Restart the Apache service.

Copy to Clipboard

Edit the Grafana configuration file grafana.ini.

Copy to Clipboard

Perform the following configuration under the [auth.proxy] area.

Copy to Clipboard

Restart the Grafana service.

Copy to Clipboard

The Apache service will listen on TCP port 80, authenticate and redirect users to the Grafana service on port 3000.

To test your Apache proxy installation, open your browser and enter the IP address of your server.

In our example, the following URL was entered in the Browser:

• http://192.168.15.11

The Apache proxy will request you to authenticate yourself before forwarding you to the Grafana service.

grafana http authentication

On the login screen, use the admin user and the password from the Apache htpasswd file.

• Username: admin
• Password: Enter the Admin htpasswd password.

After a successfull login, you will be sent directly to the Grafana dashboard.

Congratulations! You have configured the Apache Proxy authentication to Access the Grafana serice.