import{_ as a,c as e,o as s,a4 as t}from"./chunks/framework.BmdFiWrL.js";const k=JSON.parse('{"title":"Install Dashboard","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"en_US/guide/dashboard.md","filePath":"en_US/guide/dashboard.md","lastUpdated":1720539149000}'),i={name:"en_US/guide/dashboard.md"},n=t(`
To set up Nezha Monitoring, you need:
TIP
If you want to use a CDN, prepare two domains: one configured with CDN for public access (CDN must support WebSocket protocol), and another domain not using CDN for communication between the Agent and Dashboard.
This document uses "dashboard.example.com" and "data.example.com" as example domains.
This document uses the aaPanel for reverse proxying the Dashboard as an example. As future versions change, some features may change their entry points. This document is for reference only.
WARNING
This project does not depend on the aaPanel; you can choose any server panel you prefer or manually install Nginx or Caddy to configure SSL and reverse proxy.
If you do not need to use ports 80 and 443 to access the Dashboard, you can directly use the installation script to install and run Nezha Monitoring without installing Nginx.
Nezha Monitoring uses Github, Gitlab, or Gitee as admin accounts.
Application name
- Fill in as you like.Homepage URL
- Fill in with the domain for accessing the dashboard, such as "http://dashboard.example.com" (your domain).Authorization callback URL
- Fill in with the callback address, such as "http://dashboard.example.com/oauth2/callback" (don't forget /oauth2/callback
).If you encounter issues using Github, Gitlab, or Gitee as admin login, consider switching to using Cloudflare Access as the OAuth2 provider.
My Team
-> Users
-> <specific user>
-> Get User ID
and save it.Access
-> Application
-> Add an Application
.SaaS
, enter a custom application name in Application
(e.g., nezha), select OIDC
, and click Add application
.Scopes
: openid
, email
, profile
, groups
.Redirect URLs
, such as https://dashboard.example.com/oauth2/callback
.Client ID
, Client Secret
, and Issuer
address (protocol and domain part), e.g., https://xxxxx.cloudflareaccess.com
.If using this method, after installing the Dashboard, modify the configuration file /opt/nezha/dashboard/data/config.yaml
, and change the Endpoint
configuration to the Issuer
address saved earlier, e.g., https://xxxxx.cloudflareaccess.com
, and restart the Dashboard.
Run the installation script on the dashboard server:
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
After Docker installation completes, enter the following values:
OAuth provider
- choose one from github, cloudflare, gitlab, gitee.Client ID
- the previously saved Client ID.Client Secret
- the previously saved Client Secret.Username
- the username/User ID from the OAuth provider.Site title
- custom site title.Access port
- public access port, customizable, default is 8008.Agent communication port
- port for Agent and Dashboard communication, default is 5555.After inputting the values, wait for the image to be pulled.
When the installation completes, you can access the dashboard by visiting your domain and port number, such as “http://dashboard.example.com:8008”.
In the future, if you need to run the script again, run:
./nezha.sh
to open the management script.
Create a new site in the aaPanel, with the domain filled in as the public access domain, such as “http://dashboard.example.com”. Then click “Settings” to enter the site settings options, select “Reverse Proxy” - “New Reverse Proxy”.
Customize a proxy name and fill in http://127.0.0.1
in the "Target URL" below, then click “Save”.
Open the “Configuration File” on the right side of the newly created reverse proxy and replace the configuration file with the following content:
#PROXY-START/
location / {
proxy_pass http://127.0.0.1:8008;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+)$ {
proxy_pass http://127.0.0.1:8008;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
}
#PROXY-END/
Click “Save”.
Now you should be able to access the dashboard directly using the domain, such as “http://dashboard.example.com”.
CaddyServer v1 (v2 does not require special configuration):
proxy /ws http://ip:8008 {
websocket
header_upstream -Origin
}
proxy /terminal/* http://ip:8008 {
websocket
header_upstream -Origin
}
First, temporarily disable the reverse proxy.
Like configuring SSL certificates for other websites, enter the “SSL” in the site settings, and you can choose to automatically apply for a Let’s Encrypt certificate or manually configure an existing certificate.
After completing the SSL settings, go back to Github OAuth Apps and edit the previously created OAuth application. Change all the domain parts in "Homepage URL" and "Authorization callback URL" from http
to https
, such as "https://dashboard.example.com" and "https://dashboard.example.com/oauth2/callback". Failing to change this may result in being unable to log in to the admin panel.
Run the script ./nezha.sh
, and select to restart and update the dashboard.