docs: add nginx example for serving reports
This commit is contained in:
parent
29bf29a391
commit
657075ddf8
1 changed files with 28 additions and 0 deletions
28
README.md
28
README.md
|
@ -49,3 +49,31 @@ Use the `run-reports.sh` script to run all report intervals in one step. The scr
|
||||||
|
|
||||||
Running this script will create or update the hourly, daily, weekly and monthly reports under `output/`.
|
Running this script will create or update the hourly, daily, weekly and monthly reports under `output/`.
|
||||||
|
|
||||||
|
## Serving Reports with Nginx
|
||||||
|
|
||||||
|
To expose the generated HTML dashboards and JSON files over HTTP you can use a
|
||||||
|
simple Nginx server block. Point the `root` directive to the repository's
|
||||||
|
`output/` directory and optionally restrict access to your local network.
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name example.com;
|
||||||
|
|
||||||
|
# Path to the generated reports
|
||||||
|
root /path/to/ngxstat/output;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Allow access only from private networks
|
||||||
|
allow 192.0.0.0/8;
|
||||||
|
allow 10.0.0.0/8;
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
With this configuration the generated static files are served directly by
|
||||||
|
Nginx while connections outside of `192.*` and `10.*` are denied.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue