跳转至

在您自己的域名上托管控制面板

在这篇文章中

可以将控制面板托管在您的服务器上,而不是从 HOSTKEY 域名进行调用。

备注

通过编辑 HTML 文件,可以根据您的喜好自定义面板布局。

在您的域名上轻松放置 Panel 文件

  1. 下载面板代码并将其放置在您的服务器上:

    curl -L -o controlpanel.html https://invapi.hostkey.com/controlpanel.html
    

    备注

    可以从 GitHub 仓库 下载最新版本的控制面板。

  2. 使用以下方法之一设置 API 路径:

    • 通过 base 变量传递预定义的 API 路径来调用面板
    https://<path_to_the_panel_on_your_domain>/controlpanel.html?base=panel.hostkey.com&key=api-key
    

    或者

    • controlpanel.html 文件中的变量 g_base_url 替换为
    var g_base_url='panel.hostkey.com';
    

通过 nginx 进行代理访问

为了在控制面板运行时向用户隐藏 HOSTKEY 服务器信息,请按以下方式配置面板:

  1. 下载面板代码并将其放置在您的服务器上:

    mkdir /opt/panel
    cd /opt/panel
    curl -L -o controlpanel.html https://invapi.hostkey.com/controlpanel.html
    

    备注

    可以从 GitHub 仓库 下载最新版本的控制面板。

  2. /etc/nginx/conf.d 目录中创建一个名为 hostkeycp.conf 的配置文件。该文件应包含以下信息,并将 <your-domain> 替换为绑定到您服务器的域名:

    server {
            listen  80;
            server_name <your-domain>;
    
            access_log  /var/log/nginx/panel_access.log;
            error_log   /var/log/nginx/panel_error.log;
    
            root /opt/panel/;
            index controlpanel.html;
    
            location ~ ^/.+\.php$ {
            proxy_set_header Host panel.hostkey.com;
            proxy_pass https://panel.hostkey.com/$request_uri;
            }
    }
    
  3. /etc/nginx/nginx.conf 文件的 http 部分添加一行:

    resolver 8.8.8.8;
    
  4. 如果 /etc/nginx/nginx.conf 文件中缺少 include /etc/nginx/conf.d/*.conf; 这一行,请在 http 部分添加该行:

    include /etc/nginx/conf.d/hostkeycp.conf;
    
  5. 验证配置是否准确并重新加载 nginx 配置:

    nginx -t
    nginx -s reload
    

完成这些设置后,访问 URL https://<your-domain>/controlpanel.html?key=<API server key> 将打开指定服务器的控制面板。

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×