A fully loaded tool to help you get Ghost installed and configured and to make it super easy to keep your Ghost install up to date.
@latest
means this command with either install or update ghost-cli and you only have to remember the one command for both ✨
ghost-cli
:
ghost --help
or ghost [command] --help
to get more detail, or inline help for available options.
ghost config
accepts two optional arguments: key
and value
. Here are the three different combinations and what happens on each of them:
ghost config
command only affects the configuration files. In order for your new config to be used, run ghost restart
.
ghost config
to generate a configuration file, you can supply multiple key-value pairs in the form of options to avoid being prompted for that value.
All of these options can also be passed to ghost install
and ghost setup
, as these commands call ghost config
.
See the config guide or run ghost config --help
for more detailed information.
Application options
ghost restart
.
ghost install
command is your one-stop-shop to get a running production install of Ghost.
This command includes the necessary mysql, nginx and systemd configuration to get your publication online, and provides a series of setup questions to configure your new publication. The end result is a fully installed and configured instance ✨
ghost install local
installs ghost in development mode using sqlite3 and a local process manager. Read more about local installs.ghost install
command runs a nested command structure, but you only ever have to enter a single command.
First, it will run ghost doctor
to check your environment is compatible. If checks pass, a local folder is setup, and Ghost is then downloaded from npm and installed.
Next, ghost setup
runs, which will provide prompts for you to configure your new publication via the ghost config
command, including creating a MySQL user, initialising a database, configure nginx and sets up SSL.
Finally, the CLI will prompt to see if you want to run Ghost and if you choose yes ghost start
will run.
ghost install
runs nested commands, it also accepts options for the ghost doctor
, ghost config
, ghost setup
and ghost start
commands.
See the individual command docs, or run ghost install --help
for more detailed information.
ghost setup
is the most useful feature of Ghost-CLI. In most cases you will never need to run it yourself, as it’s called automatically as a part of ghost install
.
ghost
user for running GhostGhost-CLI
tool is designed to work with the recommended stack and is the only supported install method. However, since Ghost is a fully open-source project, and many users have different requirements, it is possible to setup and configure your site manually.
The CLI tool is flexible and each stage can be run individually by running ghost setup <stage-name>
or skipped by passing the --no-setup-<stage-name>
flag.
ghost setup
runs nested commands, it also accepts options for the ghost config
, ghost start
and ghost doctor
commands. Run ghost setup --help
for more detailed information.
ghost start
will start your site in background using the configured process manager. The default process manager is systemd, or local for local installs.
The command must be executed in the directory where the Ghost instance you are trying to start lives, or passed the correct directory using the --dir
option.
ghost start
gives an error, try use ghost run
to start Ghost without using the configured process manager. This runs Ghost directly, similar to node index.js
. All the output from Ghost will be written directly to your terminal, showing up any uncaught errors or other output that might not appear in log files.
ghost stop
stops the instance of Ghost running in the current directory. Alternatively it can be passed the name of a particular ghost instance or directory. You can always discover running Ghost instances using ghost ls
.
ghost restart
will stop and then start your site using the configured process manager. The default process manager is systemd, or local for local installs.
The command must be executed in the directory where the Ghost instance you are trying to start lives, or passed the correct directory using the --dir
option.
ghost restart
gives an error, try using ghost run
to debug the error.
ghost update
to upgraded to new versions of Ghost, which are typically released every 1-2 weeks.
ghost update
gives an error, try using ghost run
to debug the error.
ghost backup
to generate a zip file backup of your site data.
routes.yaml
and redirects.yaml
or redirects.json
ghost doctor
will check the system for potential hiccups when installing or updating Ghost.
This command allows you to use ghost-cli
as a diagnostic tool to find potential issues for your Ghost install, and provides information about what needs to be resolved if any issues arise.
The CLI automatically runs this command when installing, updating, starting or setting up ghost - and you can use is manually with ghost doctor
.
ghost doctor --help
for more detailed information.
ghost ls
command lists all Ghost sites and their status from the ~/.ghost/config
file. This is useful if you can’t remember where you installed a particular instance of Ghost, or are working with multiple instances (local, production, staging and so on).
ghost log
outputs the last 20 lines from the access log file for the site in the current folder.
Ghost’s default log config creates log files in the content/logs
directory, and creates two different files:
[site_descriptor].log
[site_descriptor].error.log
[proto]__[url]__[env]
e.g. http__localhost_2368__development
or https__mysite_com__production
. The files are be rotated, therefore you may see many numbered files in the content/logs
directory.
ghost log
command may not work for you. In particular the ghost log
command requires that file logging is enabled. See the logging configuration docs for more information.
ghost uninstall
must be executed in the directory containing the Ghost install that you would like to remove. The following tasks are performed:
content
folderghost uninstall --no-prompt
or ghost uninstall --force
will skip the warning and remove Ghost without a prompt.ghost-cli
commands when required.
This command is your port of call when you want to discover a list of available commands in the Ghost-CLI. You can call it at any time ✨
ghost install --help
and ghost setup --help
to get a specific list of commands and help for the install and setup processes. Don’t worry - you got this! 💪
/etc/letsencrypt
.
SSL for additional domains
You may wish to have multiple domains that redirect to your site, e.g. to have an extra TLD or to support www. domains. Ghost itself can only ever have one domain pointed at it. This is intentional for SEO purposes, however you can always redirect extra domains to your Ghost install using nginx.
If you want to redirect an HTTPS domain, you must have a certificate for it. If you want to use Ghost-CLI to generate an extra SSL setup, follow this guide:
acme.sh
manually if you need to perform extra tasks. The following command will output all available options:
systemd
is the default way of starting and stopping applications on Ubuntu. The advantage is that if Ghost crashes, systemd
will restart your instance. This is the default recommended process manager.
ghost
during the installation process. The ghost
user will be used to run your Ghost process in systemd
.
This means that Ghost will run with a user that has no system-wide permissions or a shell that can be used (similar to other services such as NGINX). Sudo is required to modify files in the The <install-directory>/content/
.
To prevent accidental permissions changes, it’s advisable to execute tasks such as image upload or theme upload using Ghost admin.
ghost-cli
enforces default linux permissions (via ghost doctor
hooks) for installations.
drwxrwxr-x
) permissions and file with 664 (-rw-rw-r--
) permissions.
These file permissions don’t need to be changed. The only change that is executed by ghost-cli is changing ownership, file permissions stay untouched.
If permissions were changed, the following two commands will revert file and directory permissions to the ones of a non-root user.
setuid
and setguid
). If your commands keep failing because of file permissions, ensure your directories have no flags!