# Ghost CLI

> Ghost CLI tool for installing, configuring, and managing Ghost CMS instances. This skill should be used when installing Ghost, configuring a production server, managing Ghost processes (start/stop/restart), updating Ghost, setting up SSL/NGINX, backing up sites, or troubleshooting Ghost installations.

- Skill: `bowtiedswan/ghost-cli` (Agent Skill)
- Install (CLI): `npx skillmds@latest add bowtiedswan/ghost-cli`
- Raw SKILL.md: https://api.skillmd.com/api/skills/bowtiedswan/ghost-cli/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: bowtiedswan (https://skillmd.com/u/bowtiedswan)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/bowtiedswan/ghost-cli

---


# Ghost CLI

## Overview

Ghost-CLI is the official command-line tool for installing and managing Ghost CMS. It handles production setup including MySQL, NGINX, SSL certificates (Let's Encrypt), and systemd process management. It also supports local development installations with SQLite.

## When to Use

- Installing Ghost on a server or locally for development
- Configuring Ghost (URL, database, mail, ports)
- Starting, stopping, or restarting Ghost instances
- Updating Ghost to new versions
- Setting up NGINX, SSL, and systemd
- Creating backups
- Diagnosing installation issues
- Managing multiple Ghost instances on one server

## Installation

```bash
sudo npm install -g ghost-cli@latest
```

Use `@latest` to install or update in one command.

## Global Flags

| Flag | Description |
|------|-------------|
| `--help`, `-h` | Display usage information |
| `--verbose`, `-V` | Enable debug logging |
| `--version`, `-v` | Print CLI and Ghost versions |
| `--dir [path]` | Execute in alternate directory |
| `--no-prompt` | Skip interactive prompts |
| `--no-color` | Disable colored output |

## Commands

### ghost install

Full production installation including MySQL, NGINX, SSL, and systemd:

```bash
ghost install                    # Latest version
ghost install [version]          # Specific version (e.g., 5.82.0)
ghost install local              # Local dev mode (SQLite, no NGINX)
ghost install --local            # Same as above
```

**Options:**
| Flag | Description |
|------|-------------|
| `--development`, `-D` | Development environment |
| `--dir [path]` | Custom install directory |
| `--archive path/to/file.tgz` | Install from local archive |
| `--no-stack` | Skip environment validation |
| `--no-setup` | Skip setup stage |
| `--no-start` | Skip automatic startup |
| `--no-enable` | Don't auto-restart on reboot |
| `--no-prompt` | Non-interactive mode |

**Directory structure created:**

```
/var/www/ghost/
├── .config.production.json    # Instance configuration
├── .ghost-cli                 # CLI metadata
├── content/                   # Themes, images, data
├── current/                   # Symlink to active version
├── system/                    # NGINX, systemd, SSL files
└── versions/                  # Ghost versions (for rollback)
```

### ghost setup

Configure server components after installation:

```bash
ghost setup                    # Run all setup stages
ghost setup mysql              # Create database user
ghost setup nginx              # Generate NGINX config
ghost setup ssl                # Let's Encrypt SSL
ghost setup nginx ssl          # NGINX + SSL combined
ghost setup linux-user         # Create ghost system user
ghost setup systemd            # Create systemd service
ghost setup migrate            # Initialize database
```

**Options:**
| Flag | Description |
|------|-------------|
| `--no-setup-mysql` | Skip database configuration |
| `--no-setup-nginx` | Skip web server setup |
| `--no-setup-ssl` | Skip SSL certificate |
| `--no-setup-systemd` | Skip process manager |
| `--no-setup-linux-user` | Skip user creation |
| `--no-setup-migrate` | Skip database migration |
| `--pname my-process` | Custom process name |

### ghost config

Manage site configuration:

```bash
ghost config                          # Create/view config
ghost config [key]                    # Get value
ghost config [key] [value]            # Set value
ghost config url https://mysite.com   # Set site URL
```

**Application options:**
```bash
ghost config --url https://mysite.com
ghost config --admin-url https://admin.mysite.com
ghost config --port 2368
ghost config --ip 127.0.0.1
ghost config --log '["file","stdout"]'
```

**Database options:**
```bash
ghost config --db mysql
ghost config --dbhost localhost
ghost config --dbuser ghost
ghost config --dbpass secret
ghost config --dbname ghost_prod

# SQLite (development)
ghost config --db sqlite3
ghost config --dbpath content/data/ghost_dev.db
```

**Mail options:**
```bash
ghost config --mail SMTP
ghost config --mailservice Mailgun
ghost config --mailuser postmaster@mg.example.com
ghost config --mailpass password
ghost config --mailhost smtp.eu.mailgun.org
ghost config --mailport 465
```

### ghost start

```bash
ghost start                    # Start Ghost
ghost start -D                 # Start in development mode
ghost start --enable           # Enable auto-restart on reboot
ghost start --no-check-mem     # Skip memory check
```

### ghost stop

```bash
ghost stop                     # Stop current instance
ghost stop [name]              # Stop named instance
ghost stop --all               # Stop all instances
ghost stop --disable           # Prevent auto-restart
```

### ghost restart

```bash
ghost restart                  # Restart current instance
ghost restart --dir /path/     # Restart specific instance
```

### ghost update

```bash
ghost update                   # Update to latest
ghost update [version]         # Update to specific version
ghost update --rollback        # Revert failed update
ghost update --force           # Force re-download
ghost update --no-restart      # Skip restart after update
ghost update --no-auto-rollback # Disable automatic rollback
ghost update --zip path.zip    # Update from local archive
ghost update --no-check-mem    # Skip memory check
```

### ghost backup

Create a full backup including:
- Content in JSON format
- Member CSV export
- All installed themes
- Images, files, media (video/audio)
- `routes.yaml` and `redirects.yaml`

```bash
ghost backup
```

### ghost doctor

Diagnostic checks for system compatibility:

```bash
ghost doctor                   # Full diagnostics
ghost doctor startup           # Configuration validation
ghost doctor setup             # Installation verification
ghost doctor --no-check-mem    # Skip memory checks
```

### ghost ls

List all Ghost instances with status:

```bash
ghost ls
```

### ghost log

View Ghost logs:

```bash
ghost log                      # Last 20 access log lines
ghost log -n 100               # Show 100 lines
ghost log -e                   # Error logs only
ghost log -f                   # Follow logs (tail -f)
ghost log -fe                  # Follow error logs
ghost log [name]               # Named instance logs
```

Log files are stored in `content/logs/`:
- Access: `https__mysite_com__production.log`
- Errors: `https__mysite_com__production.error.log`

### ghost uninstall

**Destructive** — permanently removes Ghost:

```bash
ghost uninstall                # With confirmation prompt
ghost uninstall --no-prompt    # Skip confirmation
ghost uninstall --force        # Force removal
```

Removes: Ghost process, systemd config, NGINX config, content, and files.

## SSL Configuration

Ghost integrates with Let's Encrypt via acme.sh for free SSL:

```bash
ghost setup ssl                # Interactive SSL setup
```

- Certificates auto-renew every 60 days
- Ghost supports only one canonical domain (for SEO)
- Redirect additional domains via NGINX

### Adding HTTPS Redirect for Additional Domain

```bash
ghost config url https://my-second-domain.com
ghost setup nginx ssl
ghost config url https://my-canonical-domain.com
# Edit NGINX config to add: return 301 https://my-canonical-domain.com$request_uri;
sudo nginx -t && sudo nginx -s reload
```

### Manual acme.sh

```bash
/etc/letsencrypt/acme.sh --home "/etc/letsencrypt"
```

## File Permissions

Ghost-CLI enforces these defaults:
- Non-root: directories 775, files 664
- Root: directories 755, files 644

Reset if needed:
```bash
sudo find /var/www/ghost/* -type d -exec chmod 775 {} \;
sudo find /var/www/ghost/* -type f -exec chmod 664 {} \;
```

## Production Requirements

- **Node.js:** v22+ (Ghost 6.0)
- **Database:** MySQL 8 (production), SQLite3 (development only)
- **Web Server:** NGINX (configured automatically)
- **Process Manager:** systemd (configured automatically)
- **OS:** Ubuntu 20.04+ or similar Linux (recommended)
- **Memory:** Minimum 1GB RAM

## Common Troubleshooting

| Issue | Solution |
|-------|----------|
| Port already in use | `ghost config --port 2369` or stop conflicting process |
| Permission errors | Run `ghost doctor` and fix ownership |
| NGINX config issues | `sudo nginx -t` to validate, check `/etc/nginx/` |
| SSL renewal failure | Run `ghost setup ssl` again |
| Memory errors | Use `--no-check-mem` flag or upgrade server |
| Database connection | Verify MySQL credentials with `ghost config` |

