Cursor 服务器手动安装完整指南
本指南将帮助您了解如何手动安装和配置 Cursor 服务器,确保最佳性能和可靠性。
系统要求
1. 基本要求
- Node.js v14 或更高版本
- npm 或 yarn
- Git
- Python 3.7+
2. 网络要求
- 稳定的网络连接
- 开放必要的端口
- 正确的防火墙配置
安装步骤
1. 克隆仓库
# 克隆仓库
git clone https://github.com/getcursor/cursor-server.git
# 进入目录
cd cursor-server
2. 安装依赖
# 安装 Node.js 依赖
npm install
# 安装 Python 依赖(如果需要)
pip install -r requirements.txt
3. 配置文件
创建 config.yaml
:
server:
port: 3000
host: localhost
max_connections: 100
timeout: 30000
database:
type: sqlite
path: ./data/cursor.db
logging:
level: info
file: ./logs/cursor.log
环境设置
1. 环境变量
创建 .env
文件:
NODE_ENV=development
PORT=3000
DB_PATH=./data/cursor.db
LOG_LEVEL=info
2. 开发环境
# 启动开发服务器
npm run dev
# 运行测试
npm test
服务器配置
1. 基本设置
server:
port: 3000
host: localhost
max_connections: 100
timeout: 30000
cors:
enabled: true
origin: "*"
2. 安全设置
security:
ssl:
enabled: true
cert: ./certs/cert.pem
key: ./certs/key.pem
auth:
type: jwt
secret: your-secret-key
运行服务器
1. 开发模式
# 启动开发服务器
npm run dev
# 监视文件变化
npm run watch
2. 生产模式
# 构建应用
npm run build
# 启动生产服务器
npm start
故障排除
1. 端口问题
- 检查端口占用
- 更改端口配置
- 验证防火墙设置
- 检查网络连接
2. 数据库问题
- 验证数据库连接
- 检查数据库权限
- 更新数据库配置
- 清理数据库缓存
3. 网络问题
- 检查网络连接
- 验证防火墙设置
- 测试端口访问
- 更新网络配置