-
Notifications
You must be signed in to change notification settings - Fork 1
Commands Serve
packy edited this page Jun 18, 2026
·
1 revision
启动中转 HTTP 服务(固定 IP 代理微信 API),解决 IP 白名单问题。
wx-newspic serve --api-key "sk-your-key" --port 3000| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
--api-key, -k |
是 | — | API Key 认证密钥 |
--port, -p |
否 | 3000 | 监听端口 |
--host |
否 | 0.0.0.0 | 监听地址 |
--app-id |
否 | 凭证配置 | 微信 APP_ID |
--app-secret |
否 | 凭证配置 | 微信 APP_SECRET |
--log-level |
否 | info | 日志级别 |
- 微信 API 请求转发(解决 IP 白名单问题)
- access_token 自动缓存和续期
- 图片上传中转
- 统一错误处理
创建 /etc/systemd/system/wx-newspic.service:
[Unit]
Description=wx-newspic Relay Server
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/env wx-newspic serve --api-key "sk-your-key" --port 3000
Restart=always
RestartSec=5
User=your-user
Environment=WECHAT_APP_ID=your_app_id
Environment=WECHAT_APP_SECRET=your_app_secret
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable wx-newspic
sudo systemctl start wx-newspicnpm install -g pm2
pm2 start wx-newspic -- serve --api-key "sk-your-key" --port 3000
pm2 save
pm2 startupscreen -S wx-newspic
wx-newspic serve --api-key "sk-your-key" --port 3000
# Ctrl+A D 脱离