---
title: nexcmp命令参考
description: nexcmp服务器命令行工具的所有子命令详解——status、update、backup、uninstall、open-port、close-port和fix-owner。
url: https://nexcmp.com/zh-cn/docs/getting-started/cli-reference/
applies_to: NexCMP 1.6.1
updated: 2026-11-02
---

# `nexcmp`命令参考 {#nexcmp-command-reference}

安装程序会在`/usr/local/bin/nexcmp`放置一个辅助工具。请在NexCMP服务器上运行它。更改系统的命令需要`sudo`。（用于API的客户端工具是另一个独立程序，请参阅[cmp CLI](https://nexcmp.com/zh-cn/docs/developers/cmp-cli/)。）

| 命令 | 需要root权限 | 功能说明 |
|---|---|---|
| `nexcmp status` | 否（使用`sudo`可查看更多详情） | 版本、服务状态（`nexcmp`、`nexcmp-vmd`）、`/healthz`、许可证概况、公网端口状态，以及未完成向导时的设置代码 |
| `nexcmp update` | 是 | 使用保存的参数运行已安装版本附带的安装程序——参见[更新](https://nexcmp.com/zh-cn/docs/getting-started/updating/) |
| `nexcmp backup [dir]` | 是 | 备份至`/var/backups/nexcmp`（或`dir`）— 参见[备份与恢复](https://nexcmp.com/zh-cn/docs/getting-started/backup-and-restore/) |
| `nexcmp uninstall [--purge]` | 是 | 删除服务和程序；`--purge`还会删除数据 — 参见[卸载](https://nexcmp.com/zh-cn/docs/getting-started/uninstall/) |
| `nexcmp open-port [minutes]` | 是 | **紧急访问**：在所有接口上监听面板端口（默认 3000），持续 1–1440 分钟（默认 30 分钟），随后自动关闭 |
| `nexcmp close-port` | 是 | 立即关闭紧急访问窗口 |
| `nexcmp fix-owner` | 是 | 将`/var/lib/nexcmp`中属于 root 的文件所有权归还给`nexcmp`用户 |

## `nexcmp status`

```text
Version   : 1.6.1
nexcmp     : active
nexcmp-vmd : active
healthz    : ok
License   : active · domain cloud.example.com · token valid until 2026-11-12 · updates until 2027-10-30
Public port: 127.0.0.1 only (nginx proxy; emergency: sudo nexcmp open-port)
```

如果数据目录中的文件所有者为root（例如运行另一个`nexcmp`命令并使用`sudo`以root身份创建），`status`会输出警告，因为服务用户无法读取它们—典型症状是许可证显示HTTP 421。使用`sudo nexcmp fix-owner`修复。每次服务启动时也会自动运行相同的修复。

## 紧急访问 {#emergency-access}

当域名、nginx 或 TLS 出现故障时，你仍然可以访问面板：

```bash
sudo nexcmp open-port 30          # http://<server-IP>:3000/ for 30 minutes
sudo nexcmp close-port            # close it earlier
```

更安全且无需开放任何端口的方法：`ssh -L 3000:127.0.0.1:3000 user@server`并浏览`http://127.0.0.1:3000/`。

## 环境 {#environment}

| 变量 | 用途 |
|---|---|
| `NEXCMP_BASE` | 覆盖许可证服务器基础 URL（默认`https://nexcmp.com`）；仅供测试使用 |

文件和目录：程序`/opt/nexcmp`，配置`/etc/nexcmp`，数据`/var/lib/nexcmp`，日志`/var/log/nexcmp`和`journalctl -u nexcmp -u nexcmp-vmd`。
