nezhahq.github.io/assets/en_US_guide_dashboard.md.1b96296b.js

24 lines
9.5 KiB
JavaScript

import{_ as e,c as t,o as a,d as n}from"./app.2c402e15.js";const b='{"title":"Preparations","description":"","frontmatter":{},"headers":[{"level":2,"title":"Preparations","slug":"preparations"},{"level":2,"title":"Get the Client ID and Client Secret on Github","slug":"get-the-client-id-and-client-secret-on-github"},{"level":2,"title":"Installing Dashboard on the server","slug":"installing-dashboard-on-the-server"},{"level":2,"title":"Configure reverse proxy","slug":"configure-reverse-proxy"},{"level":2,"title":"Configuring SSL in the aaPanel","slug":"configuring-ssl-in-the-aapanel"}],"relativePath":"en_US/guide/dashboard.md"}',o={},s=n(`<h2 id="preparations" tabindex="-1">Preparations <a class="header-anchor" href="#preparations" aria-hidden="true">#</a></h2><p>To setup a Nezha monitorning Dashboard, you need these things:</p><ol><li>A VPS that can connect to the Internet, firewall and security policies need to open ports 8008 and 5555, otherwise it will be inaccessible and unable to receive data. A 1 core 512MB RAM server is sufficient for most usage scenarios</li><li>A domain name that has been set up with an A record that resolves to the Dashboard server IP</li></ol><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>If you want to use CDN, please prepare two domains, one connect to CDN for public access, CDN needs to support WebSocket protocol; the other domain should not connect to CDN, use it as Agent to send data to Dashboard.<br> This document uses &quot;<a href="http://cdn.example.com" target="_blank" rel="noopener noreferrer">cdn.example.com</a>&quot; and &quot;<a href="http://data.example.com" target="_blank" rel="noopener noreferrer">data.example.com</a>&quot; domains to demonstrate respectively</p></div><ol start="3"><li>A Github account</li></ol><p><strong>This document will use the aaPanel as an example, with future versions of the changes, some of the features may change, this document is for reference only</strong><br><br></p><h2 id="get-the-client-id-and-client-secret-on-github" tabindex="-1">Get the Client ID and Client Secret on Github <a class="header-anchor" href="#get-the-client-id-and-client-secret-on-github" aria-hidden="true">#</a></h2><p>Nezha Monitor uses a Github account as the login account for the admin panel</p><ul><li>First we need to create a new authentication application, after logging into Github, open <a href="https://github.com/settings/developers" target="_blank" rel="noopener noreferrer">https://github.com/settings/developers</a> and select &quot;OAuth Apps&quot; - &quot;New OAuth App &quot;<br><code>Application name</code> - Fill in as you like<br><code>Homepage URL</code> - Fill in the panel&#39;s access domain name, such as: &quot;<a href="http://cdn.example.com" target="_blank" rel="noopener noreferrer">http://cdn.example.com</a>&quot;<br><code>Authorization callback URL</code> - Fill in the callback address, e.g., &quot;<a href="http://cdn.example.com/oauth2/callback" target="_blank" rel="noopener noreferrer">http://cdn.example.com/oauth2/callback</a>&quot;</li><li>Click on &quot;Registration Application&quot;</li><li>Remember the Client ID in the page, then click &quot;Generate a new client secret&quot; to create a new Client Secret, the new secret will be displayed only once, please save it properly <br><br></li></ul><h2 id="installing-dashboard-on-the-server" tabindex="-1">Installing Dashboard on the server <a class="header-anchor" href="#installing-dashboard-on-the-server" aria-hidden="true">#</a></h2><ul><li>In the panel server, run the installation script:</li></ul><div class="language-bash"><pre><code><span class="token function">curl</span> -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh <span class="token operator">&amp;&amp;</span> <span class="token function">chmod</span> +x nezha.sh <span class="token operator">&amp;&amp;</span> <span class="token function">sudo</span> ./nezha.sh
</code></pre></div><ul><li><p>After waiting for the Docker installation to complete, input the following settings:<br><code>OAuth2 provider</code> - Github<br><code>Client ID</code> - Previously saved Client ID<br><code>Client Secret</code> - Previously saved secret<br><code>GitHub/Gitee login name</code> - Github username<br><code>Site title</code> - Custom site title<br><code>Site access port</code> - Public access port, customizable, default 8008<br><code>RPC port</code> - The communication port between Agent and Dashboard, default 5555</p></li><li><p>After the input is complete, wait to pull the mirror<br> After the installation, if everything is fine, you can visit the domain + port number, such as &quot;<a href="http://cdn.example.com:8008" target="_blank" rel="noopener noreferrer">http://cdn.example.com:8008</a>&quot; to view the Dashboard</p></li><li><p>In the future, if you need to run the script again, you can run:</p></li></ul><div class="language-bash"><pre><code>./nezha.sh
</code></pre></div><p>to open the management script<br><br><br></p><h2 id="configure-reverse-proxy" tabindex="-1">Configure reverse proxy <a class="header-anchor" href="#configure-reverse-proxy" aria-hidden="true">#</a></h2><ul><li><p>Create a new site in the aaPanel, fill in the public access domain name, such as &quot;<a href="http://cdn.example.com" target="_blank" rel="noopener noreferrer">http://cdn.example.com</a>&quot;, then click &quot;Settings&quot; to enter the site settings option, select &quot; Reverse proxy&quot; - &quot;New reverse proxy&quot;</p></li><li><p>Customize a proxy name, fill in <code>http://127.0.0.1</code> in the &quot;Target URL&quot; and click &quot;Save&quot;</p></li><li><p>Open the &quot; configuration&quot; to the right of the new reverse proxy you just created and replace the configuration file with the following:</p></li></ul><div class="language-nginx"><pre><code><span class="token comment">#PROXY-START/</span>
<span class="token directive"><span class="token keyword">location</span> /</span> <span class="token punctuation">{</span>
<span class="token directive"><span class="token keyword">proxy_pass</span> http://127.0.0.1:8008</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Host <span class="token variable">$host</span></span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Upgrade <span class="token variable">$http_upgrade</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token directive"><span class="token keyword">location</span> ~ ^/(ws|terminal/.+)$</span> <span class="token punctuation">{</span>
<span class="token directive"><span class="token keyword">proxy_pass</span> http://127.0.0.1:8008</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_http_version</span> 1.1</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Upgrade <span class="token variable">$http_upgrade</span></span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Connection <span class="token string">&quot;Upgrade&quot;</span></span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Host <span class="token variable">$host</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">#PROXY-END/</span>
</code></pre></div><ul><li>Click &quot;Save&quot;<br> Now, you should be able to access the panel directly using a domain name such as: &quot;<a href="http://cdn.example.com" target="_blank" rel="noopener noreferrer">http://cdn.example.com</a>&quot;<br><br></li></ul><h4 id="other" tabindex="-1">Other: <a class="header-anchor" href="#other" aria-hidden="true">#</a></h4><ul><li><p>CaddyServer v1\uFF08v2 no special configuration required\uFF09</p><div class="language-"><pre><code>proxy /ws http://ip:8008 {
websocket
}
proxy /terminal/* http://ip:8008 {
websocket
}
</code></pre></div></li></ul><br><br><h2 id="configuring-ssl-in-the-aapanel" tabindex="-1">Configuring SSL in the aaPanel <a class="header-anchor" href="#configuring-ssl-in-the-aapanel" aria-hidden="true">#</a></h2><p>First, temporarily disable the reverse proxy<br> As with other websites, you can choose to automatically apply for a Let\xB4s Encrypt certificate or manually configure an existing certificate by going to &quot;SSL&quot; in the site settings<br> After you finish setting up SSL, you need to go back to <a href="https://github.com/settings/developers" target="_blank" rel="noopener noreferrer">https://github.com/settings/developers</a> and edit the authentication application you created before, change all the domain names in the &quot;Homepage URL&quot; and &quot;Authorization callback URL&quot; you filled in before from <code>http</code> to <code>https</code>, such as: &quot;<a href="https://cdn.example.com" target="_blank" rel="noopener noreferrer">https://cdn.example.com</a>&quot; and &quot;<a href="https://cdn.example.com/oauth2/callback" target="_blank" rel="noopener noreferrer">https://cdn.example.com/oauth2/callback</a>&quot;, <strong>If you don&#39;t change these links, you may not be able to log into the admin panel</strong></p>`,25),r=[s];function i(l,c,p,h,u,d){return a(),t("div",null,r)}var m=e(o,[["render",i]]);export{b as __pageData,m as default};