### Install Nginx via Script Source: https://miaomiaowux.com/docs/tutorial Executes the one-click installation script from the MiaoMiaoWu X repository. ```bash curl -fsSL https://raw.githubusercontent.com/iluobei/miaomiaowuX/main/install-nginx.sh | bash ``` -------------------------------- ### Install MiaoMiaoWu X via one-click script Source: https://miaomiaowux.com/docs/tutorial Executes the installation script on the server using curl. Requires sudo privileges. ```bash curl -sL https://raw.githubusercontent.com/iluobei/miaomiaowuX/main/install.sh | sudo bash ``` -------------------------------- ### Manage MiaoMiaoWu X with the installation script Source: https://miaomiaowux.com/docs/install-direct Use the provided shell script to install, update, or uninstall the application automatically. ```bash # 安装 curl -sL https://raw.githubusercontent.com/iluobei/miaomiaowuX/main/install.sh | sudo bash # 更新 curl -sL https://raw.githubusercontent.com/iluobei/miaomiaowuX/main/install.sh | sudo bash -s update # 卸载 curl -sL https://raw.githubusercontent.com/iluobei/miaomiaowuX/main/install.sh | sudo bash -s uninstall ``` -------------------------------- ### Install Caddy on Debian/Ubuntu Source: https://miaomiaowux.com/docs/tutorial Commands to add the official Caddy repository and install the package via apt. ```bash sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list sudo chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg sudo chmod o+r /etc/apt/sources.list.d/caddy-stable.list sudo apt update sudo apt install caddy ``` -------------------------------- ### Execute One-Click Installation Commands Source: https://miaomiaowux.com/docs/install-agent Run these commands on the remote server via SSH to install the agent. Use the embedded mode if you prefer the agent to include its own xray-core. ```bash # 外置 Xray 模式(默认,会自动安装独立 xray) curl -fsSL https://your-domain.com/api/remote/install.sh?token=SERVER_TOKEN | bash # 内联 Xray 模式(无需独立 xray,Agent 自身嵌入 xray-core) curl -fsSL "https://your-domain.com/api/remote/install.sh?token=SERVER_TOKEN&xray_mode=embedded" | bash ``` -------------------------------- ### Start Docker Compose Source: https://miaomiaowux.com/docs/install-agent Command to initialize the agent service defined in the docker-compose.yml file. ```bash docker compose up -d ``` -------------------------------- ### Deploy Master Panel Source: https://miaomiaowux.com/docs/quick-start Use the one-click script to install the master panel, which sets up a systemd service and handles updates. ```bash # 一键安装(自动检测架构、下载最新版、创建 systemd 服务) curl -sL https://raw.githubusercontent.com/iluobei/miaomiaowuX/main/install.sh | sudo bash # 安装完成后访问 http://服务器IP:12889 进入初始化向导 ``` -------------------------------- ### Automatic Xray Installation Command Source: https://miaomiaowux.com/docs/install-agent Executes the Xray installation script when xray_mode is set to external. ```bash bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install ``` -------------------------------- ### Certimate Webhook Configuration Source: https://miaomiaowux.com/docs/certificates Example configuration for integrating Certimate to push certificates via the MiaomiaowuX webhook endpoint. ```json URL: https://your-mmwx-host/api/admin/certificates/upload Method: POST Headers: Authorization: Bearer Content-Type: application/json Body: { "domain": "${CERTIMATE_DEPLOYER_COMMONNAME}", "cert_pem": "${CERTIMATE_DEPLOYER_CERTIFICATE}", "key_pem": "${CERTIMATE_DEPLOYER_PRIVATEKEY}" } ``` -------------------------------- ### Configure Shadowsocks SS2022 Source: https://miaomiaowux.com/docs/protocol-shadowsocks Example configuration for the SS2022 protocol using the 2022-blake3-aes-256-gcm encryption method. ```json { "protocol": "shadowsocks", "settings": { "method": "2022-blake3-aes-256-gcm", "password": "server-base64-key", "network": "tcp,udp", "clients": [{ "password": "client-base64-key" }] } } ``` -------------------------------- ### Update MiaoMiaoWu X via Docker Source: https://miaomiaowux.com/docs/update Pull the latest image, remove the existing container, and start a new one with the same volume mappings. ```bash # 拉取最新镜像 docker pull ghcr.io/iluobei/miaomiaowux:latest # 停止并删除旧容器 docker stop miaomiaowux && docker rm miaomiaowux # 重新运行 docker run -d \ --name miaomiaowux \ -p 12889:12889 \ -v $(pwd)/data:/app/data \ -v $(pwd)/subscribes:/app/subscribes \ -v $(pwd)/rule_templates:/app/rule_templates \ ghcr.io/iluobei/miaomiaowux:latest ``` -------------------------------- ### Configure AnyTLS Inbound with TCP and TLS Source: https://miaomiaowux.com/docs/protocol-anytls Example configuration for an AnyTLS inbound using TCP transport and TLS security. ```json { "tag": "anytls-in", "listen": "0.0.0.0", "port": 443, "protocol": "anytls", "settings": { "users": [ { "password": "your-password", "email": "user@example.com", "level": 0 } ], "paddingScheme": [ "stop=8", "0=30-30", "1=100-400" ] }, "streamSettings": { "network": "tcp", "security": "tls", "tlsSettings": { "certificates": [ { "certificateFile": "/path/to/fullchain.pem", "keyFile": "/path/to/privkey.pem" } ], "serverName": "your.domain.com" } } } ``` -------------------------------- ### Configure Caddyfile for Master and Subscription Domains Source: https://miaomiaowux.com/docs/tutorial Example configuration to proxy traffic to the master server and restrict the subscription domain to specific paths. ```caddyfile {master_domain} { reverse_proxy 127.0.0.1:12889 } {subscription_domain} { @subscriptions { path /x/* /api/clash/subscribe /api/user/package-subscribe /api/subscribe } handle @subscriptions { reverse_proxy 127.0.0.1:12889 } handle { respond 404 } } ``` -------------------------------- ### Generated Routing Rule JSON Source: https://miaomiaowux.com/docs/routed-outbound Example of routing rule structures for admin placeholders and user-assigned routed outbounds. ```json // 管理员占位规则(尚无用户分配时也存在,user 是占位 admin email) { "type": "field", "user": ["_admin__a1b2c3__hinet"], "domain": ["geosite:openai"], "inboundTag": ["HK直连"], "outboundTag": "HINET" } // 用户 A 被套餐分配到 HK直连-rout-seednet 后, // A 的子账号 email 会被自动加进这条规则的 user 列表 { "type": "field", "user": ["userA__d4e5f6__seednet"], "domain": ["geosite:openai"], "inboundTag": ["HK直连"], "outboundTag": "Seednet" } ``` -------------------------------- ### GET /api/admin/remote/outbounds Source: https://miaomiaowux.com/docs/xray-routing Retrieves the list of outbound configurations for a specific remote server. ```APIDOC ## GET /api/admin/remote/outbounds ### Description Fetches the list of configured outbounds for the specified remote server. ### Method GET ### Endpoint /api/admin/remote/outbounds ### Parameters #### Query Parameters - **server_id** (integer) - Required - The ID of the remote server. ``` -------------------------------- ### GET /api/admin/remote/routing Source: https://miaomiaowux.com/docs/xray-routing Retrieves the current routing configuration for a specific remote server. ```APIDOC ## GET /api/admin/remote/routing ### Description Retrieves the routing configuration for the specified remote server. ### Method GET ### Endpoint /api/admin/remote/routing ### Parameters #### Query Parameters - **server_id** (integer) - Required - The ID of the remote server. ``` -------------------------------- ### GET /api/clash/subscribe Source: https://miaomiaowux.com/docs/generator Generates a subscription link for a specific client format based on the user's token. ```APIDOC ## GET /api/clash/subscribe ### Description Generates a subscription link that converts nodes into a specific client format. ### Method GET ### Endpoint /api/clash/subscribe ### Parameters #### Query Parameters - **token** (string) - Required - User's subscription token (generated in user management) - **format** (string) - Required - Output format (clash, surge, loon, qx, shadowrocket, singbox, stash, surfboard, v2ray, egern) ### Request Example https://your-domain.com/api/clash/subscribe?token=example_token&format=clash ``` -------------------------------- ### Configure VMess with WebSocket and TLS Source: https://miaomiaowux.com/docs/protocol-vmess This JSON configuration defines a VMess protocol setup using WebSocket transport and TLS security. Ensure the certificate and key file paths are correctly specified for your environment. ```json { "protocol": "vmess", "settings": { "clients": [{ "id": "uuid", "alterId": 0 }] }, "streamSettings": { "network": "ws", "security": "tls", "wsSettings": { "path": "/vmess" }, "tlsSettings": { "serverName": "example.com", "certificates": [{ "certificateFile": "...", "keyFile": "..." }] } } } ``` -------------------------------- ### MMW Agent Configuration File Source: https://miaomiaowux.com/docs/install-agent The YAML configuration file located at /etc/mmw-agent/config.yaml, generated by the installation script. ```yaml # MMWX Remote Server Configuration # Generated by install script mode: remote master_url: https://your-domain.com token: SERVER_TOKEN connection_mode: websocket # websocket | http | pull | auto xray_mode: external # external | embedded steal_mode: # 留空 / tunnel(自动偷自己时填 tunnel) master_public_key: listen_port: "23889" ``` -------------------------------- ### Configure Trojan with TCP and REALITY Source: https://miaomiaowux.com/docs/protocol-trojan Use this configuration for a Trojan setup over TCP using the REALITY security layer. Requires valid privateKey and shortIds for proper operation. ```json { "protocol": "trojan", "settings": { "clients": [{ "password": "your-password" }] }, "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "dest": "dl.google.com:443", "serverNames": ["dl.google.com"], "privateKey": "...", "shortIds": [""] } } } ``` -------------------------------- ### Download and run the binary manually Source: https://miaomiaowux.com/docs/install-direct Download the specific binary for your architecture and set execution permissions to run the application. ```bash # Linux amd64 wget https://github.com/iluobei/miaomiaowux/releases/latest/download/mmwx-linux-amd64 chmod +x mmwx-linux-amd64 # 运行 ./mmwx-linux-amd64 ``` -------------------------------- ### Update MiaoMiaoWu X via Binary Source: https://miaomiaowux.com/docs/update Stop the service, replace the existing binary file with the new version, and restart the service to trigger auto-migration. ```bash # 停止服务 systemctl stop miaomiaowux # 替换二进制 cp mmwx-linux-amd64-new /opt/mmwx/mmwx-linux-amd64 # 重启 systemctl start miaomiaowux ``` -------------------------------- ### Create a systemd service file Source: https://miaomiaowux.com/docs/install-direct Define a systemd unit file to manage the MiaoMiaoWu X process as a background service. ```ini [Unit] Description=MiaomiaoWuX After=network.target [Service] Type=simple ExecStart=/opt/mmwx/mmwx-linux-amd64 WorkingDirectory=/opt/mmwx Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ``` -------------------------------- ### Configure runtime options Source: https://miaomiaowux.com/docs/install-direct Set environment variables or use a YAML configuration file to customize the application runtime. ```bash # 环境变量 export PORT=12889 export JWT_SECRET=your-secret-key export LOG_LEVEL=info # 或使用配置文件 ./mmwx-linux-amd64 -c config.yaml # 数据目录(相对于工作目录,不可通过环境变量更改): # data/mmwx.db 数据库 # data/logs/ 日志 # subscribes/ 订阅文件 # rule_templates/ 规则模板 ``` -------------------------------- ### Deploy Agent with docker run Source: https://miaomiaowux.com/docs/install-agent Use this command for manual or one-off testing. Ensure the host network mode is enabled as the container entrypoint enforces this check. ```bash # host 网络必须 --network host(强制约束,容器内 entrypoint 会检测;bridge 模式直接退出报错) docker run -d \ --name mmw-agent \ --network host \ --restart unless-stopped \ -e MMWX_LISTEN_PORT=12888 \ -e MMWX_MASTER_URL=https://master.example.com \ -e MMWX_MASTER_TOKEN=<主控添加服务器时生成的 token> \ -v $(pwd)/config:/etc/mmw-agent \ -v $(pwd)/xray-config:/usr/local/etc/xray \ -v $(pwd)/nginx-cert:/etc/nginx/cert \ -v $(pwd)/nginx-servers:/etc/nginx/servers \ ghcr.io/iluobei/mmw-agent:latest ``` -------------------------------- ### Deploy MiaoMiaoWu X with Docker CLI Source: https://miaomiaowux.com/docs/install-docker Pull the latest image and run the container with necessary volume mounts for data persistence. ```bash # 拉取镜像 docker pull ghcr.io/iluobei/miaomiaowux:latest # 运行容器(只暴露面板 http 端口即可) docker run -d \ --name miaomiaowux \ -p 12889:12889 \ -v $(pwd)/data:/app/data \ -v $(pwd)/subscribes:/app/subscribes \ -v $(pwd)/rule_templates:/app/rule_templates \ ghcr.io/iluobei/miaomiaowux:latest # 开启 HTTPS:推荐在【主控宿主机】上装一个 agent,用它的 nginx 反代主控(见下方章节), # 无需给容器映射 80/443。 ``` -------------------------------- ### Upload and Configure SSL Certificates Source: https://miaomiaowux.com/docs/tutorial Commands to transfer certificate files to the server and set up the required directory structure with appropriate permissions. ```bash # 先在本地执行,将解压后的证书上传到主控服务器 scp fullchain.pem privkey.pem root@{server_ip}:/tmp/ # 再登录主控服务器执行;将 {domain} 替换为对应域名 sudo mkdir -p /usr/local/nginx/cert/{domain} sudo cp /tmp/fullchain.pem /usr/local/nginx/cert/{domain}/fullchain.pem sudo cp /tmp/privkey.pem /usr/local/nginx/cert/{domain}/privkey.pem sudo chmod 644 /usr/local/nginx/cert/{domain}/fullchain.pem sudo chmod 600 /usr/local/nginx/cert/{domain}/privkey.pem ``` -------------------------------- ### Deploy MiaoMiaoWu X with Docker Compose Source: https://miaomiaowux.com/docs/install-docker Use a docker-compose.yml file to manage the container configuration and persistent volumes. ```yaml version: '3' services: miaomiaowux: image: ghcr.io/iluobei/miaomiaowux:latest container_name: miaomiaowux restart: always ports: - "12889:12889" # 主控面板(http)。HTTPS 由宿主机 agent 反代,无需映射 80/443 volumes: - ./data:/app/data - ./subscribes:/app/subscribes - ./rule_templates:/app/rule_templates environment: - PORT=12889 - JWT_SECRET=your-secret-key ``` -------------------------------- ### VLESS + TCP + REALITY + Vision Configuration Source: https://miaomiaowux.com/docs/protocol-vless Recommended configuration using TCP transport with REALITY security and XTLS-Vision flow control. ```json { "protocol": "vless", "settings": { "clients": [{ "id": "uuid", "flow": "xtls-rprx-vision" }], "decryption": "none" }, "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "dest": "dl.google.com:443", "serverNames": ["dl.google.com"], "privateKey": "...", "shortIds": [""] } } } ``` -------------------------------- ### Configure OpenClaw MCP Source: https://miaomiaowux.com/docs/mcp Add the MiaoMiaoWu X server configuration to the OpenClaw JSON configuration file. ```json { "mcp": { "servers": { "miaomiaowux": { "url": "https://你的主控/mcp", "transport": "streamable-http", "headers": { "Authorization": "Bearer <你的 API 令牌>" } } } } } ``` -------------------------------- ### Certificate File Paths Source: https://miaomiaowux.com/docs/certificates Default storage locations for certificate and private key files on remote servers. ```text 证书文件路径(远程服务器): 证书: /root/cert/{domain}/fullchain.pem 私钥: /root/cert/{domain}/privkey.pem ``` -------------------------------- ### Deploy Agent with Docker Compose Source: https://miaomiaowux.com/docs/install-agent Recommended for production environments to simplify future upgrades. Requires host network mode. ```yaml version: '3.8' services: mmw-agent: image: ghcr.io/iluobei/mmw-agent:latest container_name: mmw-agent restart: unless-stopped network_mode: host # 必须 host,bridge 模式 entrypoint 会拒启 environment: - MMWX_LISTEN_PORT=12888 - MMWX_MASTER_URL=https://master.example.com - MMWX_MASTER_TOKEN=<主控添加服务器时生成的 token> volumes: - ./config:/etc/mmw-agent - ./xray-config:/usr/local/etc/xray - ./nginx-cert:/etc/nginx/cert - ./nginx-servers:/etc/nginx/servers ``` -------------------------------- ### Configure Hermes Agent MCP Source: https://miaomiaowux.com/docs/mcp Add the MiaoMiaoWu X server configuration to the Hermes Agent YAML configuration file. ```yaml mcp_servers: miaomiaowux: url: "https://你的主控/mcp" headers: Authorization: "Bearer <你的 API 令牌>" connect_timeout: 15 timeout: 600 # 安装 xray/nginx 等工具会阻塞数分钟,超时给大点 # 可选:只放开想用的工具 # tools: # include: [server_list, user_list, package_list, traffic_summary, node_list] ``` -------------------------------- ### Certificate Application Configuration Source: https://miaomiaowux.com/docs/tutorial Configuration values for applying a wildcard certificate. ```markdown Input| Content| Note ---|---|--- Domain| `*.example.com`| Apply for wildcard certificate Email| Your email| For certificate notifications CA Provider| Let's Encrypt| Default option Target Server| Master| Default is fine Verification Method| DNS-01| Wildcard certificates must use DNS-01 DNS Provider| Select added provider| Auto Renew| Enabled| Enabled by default Auto Deploy| Disabled| When enabled, auto-redeploy on renewal ``` -------------------------------- ### Define AnyTLS Padding Scheme Source: https://miaomiaowux.com/docs/protocol-anytls Configure traffic obfuscation rules at the inbound level. Leave empty to use the server's built-in default. ```text stop=8 0=30-30 1=100-400 2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000 3=9-9,500-1000 4=500-1000 5=500-1000 6=500-1000 7=500-1000 ``` -------------------------------- ### Configure Snell v6 Inbound Source: https://miaomiaowux.com/docs/protocol-snell Use this configuration for Snell v6, which requires a shared PSK and a unique per-user clientID. ```json { "tag": "snell-in", "listen": "0.0.0.0", "port": 8443, "protocol": "snell", "settings": { "users": [ { "psk": "shared-psk", "version": 6, "v6Mode": "default", "clientId": "a1b2c3d4e5f6", "email": "user@example.com" } ] } } ``` -------------------------------- ### POST /api/admin/certificates/upload Source: https://miaomiaowux.com/docs/certificates Uploads a TLS certificate and private key to the system. If the domain exists, the record is updated and auto-deployed; otherwise, a new record is created. ```APIDOC ## POST /api/admin/certificates/upload ### Description Uploads a TLS certificate and private key to the system. This endpoint is designed for integration with external issuance systems like Certimate. Once uploaded, the system automatically deploys the certificate to all remote servers tagged with the domain. ### Method POST ### Endpoint https://your-mmwx-host/api/admin/certificates/upload ### Parameters #### Request Body - **domain** (string) - Required - The main domain bound to the certificate (e.g., *.example.com). - **cert_pem** (string) - Required - Certificate PEM text; accepts raw PEM or base64 encoded strings. - **key_pem** (string) - Required - Private key PEM text; accepts raw PEM or base64 encoded strings. ### Request Example { "domain": "*.example.com", "cert_pem": "-----BEGIN CERTIFICATE-----\n...", "key_pem": "-----BEGIN PRIVATE KEY-----\n..." } ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **certificate_id** (integer) - The ID of the uploaded certificate record. #### Response Example { "success": true, "certificate_id": 1 } ``` -------------------------------- ### Validate and Reload Caddy Source: https://miaomiaowux.com/docs/tutorial Commands to verify the configuration file syntax and apply changes to the running service. ```bash sudo caddy validate --config /etc/caddy/Caddyfile sudo systemctl reload caddy ``` -------------------------------- ### Configure Hysteria2 in Xray-core Source: https://miaomiaowux.com/docs/protocol-hysteria2 Defines the protocol settings and stream settings required for a Hysteria2 server implementation. ```json { "protocol": "hysteria", "settings": { "version": 2, "clients": [{ "auth": "your-password" }] }, "streamSettings": { "network": "hysteria", "security": "tls", "tlsSettings": { "serverName": "example.com", "alpn": ["h3"], "certificates": [{ "certificateFile": "/path/to/cert.pem", "keyFile": "/path/to/key.pem" }] } } } ``` -------------------------------- ### Verify Certificate Upload via cURL Source: https://miaomiaowux.com/docs/certificates Command to test the certificate upload endpoint using cURL and jq to read local PEM files. ```bash curl -X POST https://your-mmwx-host/api/admin/certificates/upload \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d "$(jq -n --rawfile cert /path/to/fullchain.pem \ --rawfile key /path/to/privkey.pem \ '{domain:"*.example.com", cert_pem:$cert, key_pem:$key}')" ``` -------------------------------- ### Subscription Link Format Source: https://miaomiaowux.com/docs/generator The base URL structure for requesting a subscription, requiring a user token and a specified output format. ```text https://your-domain.com/api/clash/subscribe?token=<用户Token>&format=<格式> ``` -------------------------------- ### Master Service Configuration Source: https://miaomiaowux.com/docs/system-settings Defines the core settings for the Master service, including port, database path, and security keys. ```yaml # config.yaml port: 12889 database_path: data/traffic.db jwt_secret: your-secret-key log_level: info allowed_origins: "*" ``` -------------------------------- ### Configure Snell v4 / v5 Inbound Source: https://miaomiaowux.com/docs/protocol-snell Use this configuration for Snell v4 or v5, which utilizes per-user PSK authentication and optional obfuscation modes. ```json { "tag": "snell-in", "listen": "0.0.0.0", "port": 8443, "protocol": "snell", "settings": { "users": [ { "psk": "your-psk", "version": 4, "obfsMode": "none", "email": "user@example.com" } ] } } ``` -------------------------------- ### Manual Backup Commands for MMW Source: https://miaomiaowux.com/docs/upgrade-from-mmw Commands to stop the MMW service and create a backup archive for manual migration. ```bash # 在 mmw 机器上: systemctl stop miaomiaowu cd /path/to/miaomiaowu zip -r /tmp/mmw-backup.zip data/ subscribes/ scp /tmp/mmw-backup.zip 你@mmwx 主控:/tmp/ ``` -------------------------------- ### Access Master Panel Source: https://miaomiaowux.com/docs/tutorial The URL to access the MiaoMiaoWuX master panel interface. ```text http://mmwx.example.com:12889 ``` -------------------------------- ### Reset Admin Password via CLI Source: https://miaomiaowux.com/docs/faq-common-ops Use this one-liner to reset the admin password if the web interface is inaccessible. It automatically detects the deployment environment and updates the database. ```bash bash <(curl -fsSL https://raw.githubusercontent.com/iluobei/miaomiaowuX/refs/heads/main/scripts/reset-admin-password.sh) ``` -------------------------------- ### Agent Connection Configuration Source: https://miaomiaowux.com/docs/system-settings Configures the connection parameters for remote Agent nodes to communicate with the Master server. ```yaml # config.yaml (Agent 端) master_url: "https://your-master-domain.com" token: "your-server-token" listen_port: "23889" connection_mode: "auto" traffic_report_interval: "1m" speed_report_interval: "3s" restart_method: "auto" restart_command: "" ``` -------------------------------- ### Configure Master Domain Nginx Server Block Source: https://miaomiaowux.com/docs/tutorial Nginx configuration for the master domain to proxy the full administration panel. ```nginx server { listen 443; #listen 443 quic; listen [::]:443; #listen [::]:443 quic; http2 on; server_name {domain}; ssl_certificate /usr/local/nginx/cert/{domain}/fullchain.pem; ssl_certificate_key /usr/local/nginx/cert/{domain}/privkey.pem; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_prefer_server_ciphers on; error_page 497 https://$host:443$1; #add_header Alt-Svc 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000'; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; location / { proxy_ssl_server_name on; proxy_set_header Host $host; client_max_body_size 512M; proxy_set_header Connection $http_connection; proxy_set_header Upgrade $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:12889; } proxy_read_timeout 600s; proxy_connect_timeout 600s; } ``` -------------------------------- ### POST /api/admin/remote/services/control Source: https://miaomiaowux.com/docs/xray-routing Performs service control operations, such as restarting the Xray service. ```APIDOC ## POST /api/admin/remote/services/control ### Description Controls the Xray service on a remote server, specifically used for restarting the service. ### Method POST ### Endpoint /api/admin/remote/services/control ### Parameters #### Query Parameters - **server_id** (integer) - Required - The ID of the remote server. ``` -------------------------------- ### Configure Subscription Domain Nginx Server Block Source: https://miaomiaowux.com/docs/tutorial Nginx configuration for the subscription domain, restricting access to specific API endpoints and returning 404 for others. ```nginx server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name {domain}; ssl_certificate /usr/local/nginx/cert/{domain}/fullchain.pem; ssl_certificate_key /usr/local/nginx/cert/{domain}/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; # Allowed endpoints: # /x/{code} short links and package subscription links # /api/clash/subscribe direct Clash/Mihomo subscriptions # /api/user/package-subscribe direct package subscriptions # /api/subscribe compatibility endpoint location ~ ^(?:/x/|/api/(?:clash/subscribe|user/package-subscribe|subscribe)$) { proxy_pass http://127.0.0.1:12889; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; proxy_buffering off; proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; } location / { return 404; } } ``` -------------------------------- ### MMW Agent Systemd Service Definition Source: https://miaomiaowux.com/docs/install-agent The systemd service file located at /etc/systemd/system/mmw-agent.service used to manage the agent process. ```ini [Unit] Description=MMW Agent Remote Server After=network.target [Service] Type=simple ExecStart=/usr/local/bin/mmw-agent -c /etc/mmw-agent/config.yaml Restart=always RestartSec=5 WorkingDirectory=/var/lib/mmw-agent [Install] WantedBy=multi-user.target ``` -------------------------------- ### POST /api/admin/remote/routing Source: https://miaomiaowux.com/docs/xray-routing Modifies the routing configuration by adding, removing, or setting rules. ```APIDOC ## POST /api/admin/remote/routing ### Description Modifies the routing configuration on a remote server using actions such as add_rule, remove_rule, or set. ### Method POST ### Endpoint /api/admin/remote/routing ### Parameters #### Query Parameters - **server_id** (integer) - Required - The ID of the remote server. ``` -------------------------------- ### Define Routing Rule for AI Service Traffic Source: https://miaomiaowux.com/docs/routed-outbound Configures a field-based routing rule to direct OpenAI traffic from a specific inbound tag to the HINET outbound exit. ```json { "type": "field", "domain": ["geosite:openai"], "inboundTag": ["HK直连"], "outboundTag": "HINET" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.