You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: tutorials/install-secure-netdata/01.en.md
+125-49
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
SPDX-License-Identifier: MIT
3
3
path: "/tutorials/install-secure-netdata"
4
4
slug: "install-secure-netdata"
5
-
date: "2020-05-13"
5
+
date: "2024-08-29"
6
6
title: "Install and secure Netdata using nginx http basic authentication"
7
7
short_description: "In this article, we're going to install Netdata, a linux monitoring software, and secure it using nginx http basic authentication"
8
8
tags: ["netdata", "monitoring", "linux"]
@@ -18,14 +18,19 @@ cta: "cloud"
18
18
19
19
## Introduction
20
20
21
-
In this tutorial, we're going to install Netdata and learn how to prevent public access to its web interface since Netdata doesn't provide authentication by itself.
21
+
In this tutorial, we're going to install Netdata and learn how to prevent public access to its web interface, since Netdata doesn't provide authentication by itself.
22
22
23
23
Netdata is a distributed, real-time performance and health monitoring tool for systems and applications. It is a highly-optimized monitoring agent that can be installed on Linux servers.
24
24
25
25
**Prerequisites**
26
26
27
27
* A fresh CentOS or Ubuntu installation (almost all mainstream distributions are supported though)
28
-
* Root access to the server
28
+
* Access to the root user or a user with sudo permissions
29
+
30
+
**Example terminology**
31
+
32
+
* Domain: `example.com`
33
+
* Username: `holu`
29
34
30
35
## Step 1 - Install and configure Netdata
31
36
@@ -38,41 +43,99 @@ In order to install the latest version of Netdata, you can use a bash script pro
Find the `[web]` section and uncomment the `bind to` setting and replace it with the following:
124
+
Find the `[web]` section and uncomment the `bind to` setting. Replace it with the following:
71
125
72
126
```
73
127
bind to = 127.0.0.1
74
128
```
75
129
130
+
Now, apply the change:
131
+
132
+
```bash
133
+
sudo systemctl restart netdata
134
+
sudo systemctl status netdata
135
+
```
136
+
137
+
After the restart, you can no longer access the Netdata web interface at `<your_host>:19999`.
138
+
76
139
## Step 2 - Install and configure NGINX
77
140
78
141
In this step, we will install NGINX to set up a reverse proxy so we're able to access the Netdata web interface securely.
@@ -82,29 +145,41 @@ In this step, we will install NGINX to set up a reverse proxy so we're able to a
82
145
You can install NGINX and apache2-utils by running the following commands:
83
146
(apache2-utils is needed for the second part of this step)
84
147
85
-
Debian/Ubuntu:
148
+
* Debian/Ubuntu:
149
+
```bash
150
+
sudo apt install nginx apache2-utils
151
+
```
152
+
153
+
* Redhat/CentOS/Fedora:
154
+
```bash
155
+
sudo yum install nginx httpd-tools
156
+
```
157
+
158
+
Your NGINX setup should be good to go.
86
159
87
160
```bash
88
-
sudo apt install nginx apache2-utils
161
+
nginx -version
162
+
sudo systemctl status nginx
89
163
```
90
164
91
-
Redhat/CentOS/Fedora:
165
+
If it is not running yet, you can start it with:
92
166
93
167
```bash
94
-
sudo yum install nginx apache2-utils
168
+
sudo systemctl enable nginx
169
+
sudo systemctl start nginx
95
170
```
96
171
97
-
Your NGINX setup should be good to go.
98
-
99
172
### Step 2.2 - Setup Authentication
100
173
101
174
Run this command to create a username-password pair:
102
175
176
+
> Replace `holu` with a username of your choice.
177
+
103
178
```bash
104
-
sudo htpasswd -c /etc/nginx/.htpasswd user1
179
+
sudo htpasswd -c /etc/nginx/.htpasswd holu
105
180
```
106
181
107
-
Press Enter and type the password for user1 at the prompts.
182
+
Press Enter and type the password for holu at the prompts.
108
183
109
184
Confirm that the username-password pair has been created by running:
110
185
@@ -114,38 +189,39 @@ cat /etc/nginx/.htpasswd
114
189
115
190
### Step 2.3 - Configuration
116
191
117
-
Open your NGINX configuration file (`nginx.conf`) and find the `http` block. (Your `nginx.conf` file usually is located in `/usr/local/nginx/conf`, `/etc/nginx`, or `/usr/local/etc/nginx`)
192
+
Open your NGINX configuration file (`nginx.conf`) and find the `http` block. Your `nginx.conf` file is usually located in `/usr/local/nginx/conf`, `/etc/nginx`, or `/usr/local/etc/nginx`-
0 commit comments