Skip to content

Commit a8fe51f

Browse files
committed
edits
1 parent a3a0c0a commit a8fe51f

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

content/includes/use-cases/monitoring/enable-nginx-plus-api.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,49 @@ files:
88
To collect comprehensive metrics for NGINX Plus -- including bytes streamed, information about upstream systems and caches, and counts of all HTTP status codes -- add the following to your NGINX Plus configuration file (for example, `/etc/nginx/nginx.conf` or an included file):
99

1010
```nginx
11-
# Server block for enabling the NGINX Plus API and dashboard
12-
#
13-
# This block requires NGINX Plus. It turns on the API in write mode
14-
# and serves the built-in dashboard for monitoring.
15-
# Change the listen port if 9000 conflicts; 8080 is the conventional API port.
16-
# For production, secure the API with TLS and limit access by IP or auth.
11+
# This block:
12+
# - Enables the read-write NGINX Plus API under /api/
13+
# - Serves the built-in dashboard at /dashboard.html
14+
# - Restricts write methods (POST, PATCH, DELETE) to authenticated users
15+
# and a specified IP range
1716
server {
18-
# Listen for API and dashboard traffic
19-
listen 9000 default_server;
20-
server_name localhost;
17+
listen 9000 default_server;
18+
# If port 9000 is in use, you can also use 8080:
19+
# listen 8080 default_server;
20+
server_name localhost;
2121
2222
# Handle API calls under /api/ in read-write mode
2323
location /api/ {
2424
api write=on;
25+
26+
# allow GET from anywhere
27+
allow 0.0.0.0/0;
28+
deny all;
29+
30+
# require auth and limit write methods to your network
31+
limit_except GET {
32+
auth_basic "NGINX Plus API";
33+
auth_basic_user_file /etc/nginx/conf.d/api.htpasswd;
34+
allow 192.0.2.0/24 # example IP range; replace with yours
35+
deny all;
36+
}
2537
}
2638
2739
# Serve the dashboard page at /dashboard.html
2840
location = /dashboard.html {
2941
root /usr/share/nginx/html;
3042
}
3143
32-
# Redirect any request to the root path “/” to the dashboard
44+
# Redirect any request to “/” to the dashboard
3345
location / {
3446
return 301 /dashboard.html;
3547
}
3648
}
3749
```
3850

39-
For more details, see the [NGINX Plus API module documentation](https://nginx.org/en/docs/http/ngx_http_api_module.html).
51+
For more details, see the [NGINX Plus API module documentation](https://nginx.org/en/docs/http/ngx_http_api_module.html) and [Configuring the NGINX Plus API]({{< ref “nginx/admin-guide/monitoring/live-activity-monitoring.md#configuring-the-api” >}}).
4052

41-
After saving the changes, reload NGINX to apply the new configuration:
53+
After saving the changes, reload NGINX:
4254

4355
```shell
4456
nginx -s reload

content/nginx-one/workshops/lab2/run-workshop-components-with-docker.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ Make sure you have:
4848
cd static/workshops/nginx-one/lab2
4949
```
5050

51-
This folder contains `docker-compose.yml` and `generate_certs.sh`.
51+
This folder contains `compose.yaml` and `generate_certs.sh`.
5252

53-
{{<fa "download">}} {{<link "/workshops/nginx-one/lab2/docker-compose.yml" "Download docker-compose.yaml">}}
53+
{{<fa "download">}} {{<link "/workshops/nginx-one/lab2/compose.yaml" "Download compose.yaml">}}
5454

5555
{{<fa "download">}} {{<link "/workshops/nginx-one/lab2/generate_certs.sh" "Download generate_certs.sh">}}
5656

content/nginx-one/workshops/lab4/config-sync-groups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ You can edit the `docker-config.yaml` file to add those instances to the config
117117
docker compose down
118118
```
119119

120-
2. Open `docker-compose.yaml` in a text editor.
120+
2. Open `compose.yaml` in a text editor.
121121
3. Uncomment the lines beginning with:
122122

123123
```yaml

content/nginx-one/workshops/lab5/upgrade-nginx-plus-to-latest-version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Make sure you have:
4848
--username "$JWT" --password-stdin
4949
```
5050

51-
2. Open `docker-compose.yaml` in a text editor and uncomment the **plus4** service block (lines 74–95). This block pulls the latest Debian NGINX Plus image with the latest NGINX Agent installed, and sets your data plane key, JWT, and config sync group.
51+
2. Open `compose.yaml` in a text editor and uncomment the **plus4** service block (lines 74–95). This block pulls the latest Debian NGINX Plus image with the latest NGINX Agent installed, and sets your data plane key, JWT, and config sync group.
5252

5353
```yaml
5454
plus4: # Debian latest NGINX Plus Web / Load Balancer

0 commit comments

Comments
 (0)