---
title: nexcmp 指令參考
description: nexcmp 伺服器命令列工具的每個子指令 — status、update、backup、uninstall、open-port、close-port 與 fix-owner。
url: https://nexcmp.com/zh-tw/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-tw/docs/developers/cmp-cli/)。）

| 指令 | 需要 root | 功能 |
|---|---|---|
| `nexcmp status` | 否（使用 `sudo` 取得更多詳細資料） | 版本、服務狀態（`nexcmp`、`nexcmp-vmd`）、`/healthz`、授權摘要、公開連接埠狀態、若精靈未完成則顯示設定代碼 |
| `nexcmp update` | 是 | 使用儲存的參數執行已安裝版本中隨附的安裝程式 — 請參閱 [Updating](https://nexcmp.com/zh-tw/docs/getting-started/updating/) |
| `nexcmp backup [dir]` | 是 | 備份至 `/var/backups/nexcmp`（或 `dir`）——見 [Backup and restore](https://nexcmp.com/zh-tw/docs/getting-started/backup-and-restore/) |
| `nexcmp uninstall [--purge]` | 是 | 移除服務與程式；`--purge` 同時也會移除資料——見 [Uninstall](https://nexcmp.com/zh-tw/docs/getting-started/uninstall/) |
| `nexcmp open-port [minutes]` | 是 | **Emergency**：在所有介面上監聽面板連接埠（預設 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 擁有（例如以 root 身分執行另一個 `nexcmp` 命令與 `sudo`），`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`。
