BaoTa Panel Deployment Guide
Complete GEO Wiki Pro BaoTa Panel deployment guide, from installing the panel to configuring Nginx reverse proxy, including troubleshooting tips
# BaoTa Panel Deployment Guide
> Complete GEO Wiki Pro BaoTa Panel deployment guide, from installing the panel to configuring Nginx reverse proxy, including troubleshooting tips
---
## Overview
BaoTa Panel is a commonly used server management tool in China, providing a graphical interface for managing websites, databases, SSL certificates, etc. This article explains how to deploy GEO Wiki Pro on BaoTa Panel.
---
## Prerequisites
| Requirement | Description |
|-------------|-------------|
| Server | Linux server (recommended Ubuntu 20.04+ / CentOS 7+) |
| BaoTa Panel | BaoTa Panel installed |
| Node.js | v18 or higher |
| PM2 | For process management |
---
## Step 1: Install Node.js
Install Node.js 18+ through BaoTa Panel's **Software Store** → **Node.js Version Manager**.
Or use command line:
```bash
# Install Node.js 18
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify installation
node -v # Should show v18.x.x
npm -v # Should show 9.x.x
```
---
## Step 2: Upload Code
1. Create website directory in BaoTa Panel: `/www/wwwroot/geowiki`
2. Upload GEO Wiki Pro code to that directory
3. Extract code files
```bash
cd /www/wwwroot/geowiki
npm install --production
```
---
## Step 3: Configure Environment Variables
Create `.env` file:
```bash
cat > .env << 'EOF'
NODE_ENV=production
PORT=3002
JWT_SECRET=your-secret-key-here-min-32-chars
BASE_URL=https://your-domain.com
EOF
```
::: warning
`JWT_SECRET` must be set with minimum 32 characters. Use a randomly generated strong secret in production.
:::
---
## Step 4: Start Service
Use PM2 for process management:
```bash
# Install PM2
npm install -g pm2
# Start service
pm2 start server/index.js --name geo-wiki
# Set auto-start on boot
pm2 save
pm2 startup
```
Verify service is running:
```bash
pm2 status
curl http://localhost:3002/api/v1/health
```
---
## Step 5: Configure Nginx Reverse Proxy
In BaoTa Panel → **Website** → **Settings** → **Reverse Proxy**:
| Configuration | Value |
|--------------|-------|
| Proxy Name | geowiki |
| Target URL | http://127.0.0.1:3002 |
| Send Domain | $host |
Or manually edit Nginx configuration:
```nginx
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:3002;
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 $scheme;
}
}
```
---
## Step 6: Configure SSL Certificate
In BaoTa Panel → **Website** → **SSL** → Apply for free Let's Encrypt certificate.
---
## Troubleshooting Tips
### 1. PM2 Exits Immediately After Start
**Cause**: Node.js version incompatibility or missing dependencies.
**Solution**:
```bash
# Check logs
pm2 logs geo-wiki
# Ensure Node.js version >= 18
node -v
# Reinstall dependencies
npm install --production
```
### 2. Nginx 502 Bad Gateway
**Cause**: Node.js service not started or port mismatch.
**Solution**:
```bash
# Check if service is running
pm2 status
# Check if port is correct
netstat -tlnp | grep 3002
```
### 3. File Upload Failure
**Cause**: Nginx upload size limit.
**Solution**: Add to Nginx configuration:
```nginx
client_max_body_size 50M;
```
### 4. Cookie / Login Issues
**Cause**: Nginx not properly passing cookies.
**Solution**: Ensure `proxy_set_header Host $host;` is configured.
### 5. Static Files 404
**Cause**: Nginx prioritizing static file path matching.
**Solution**: Ensure SPA fallback configuration is correct:
```nginx
location / {
proxy_pass http://127.0.0.1:3002;
try_files $uri $uri/ /index.html;
}
```
### 6. HSTS Causes SSL Errors
**Cause**: Helmet enables HSTS by default, browser forces HTTPS upgrade in HTTP environment.
**Solution**: Set `ENABLE_HSTS=false` in `.env` (if not using SSL).
---
## Common Commands
```bash
# Check status
pm2 status
# View logs
pm2 logs geo-wiki
# Restart service
pm2 restart geo-wiki
# Stop service
pm2 stop geo-wiki
# Delete service
pm2 delete geo-wiki
```
---
## Related Documents
- [Docker Deployment Guide](/docs/docker-deployment)
- [5-Minute Quick Start](/docs/quick-start)
- [Security Mechanisms](/docs/security)