GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.ghost.org — Configuration - Ghost Developer Docs OverviewWhen you install Ghost using the supported and recommended method usingghost-cli, a custom configuration file is created for you by default. There are some configuration options which are required by default, and many optional configurations.
The three required options are url and database which are configured during setup, and mail which needs to be configured once you’ve installed Ghost.
This article explains how to setup your mail config, as well as walk you through all of the available config options.
Custom configuration filesThe configuration is managed by nconf. A custom configuration file must be a valid JSON file located in the root folder and changes to the file can be implemented usingghost restart.
Since Node.js has the concept of environments built in, Ghost supports two environments: development and production. All public Ghost publications run in production mode, while development mode can be used to test or build on top of Ghost locally.
Check out the official install guides for development and production.
Ghost in developmentIf you would like to start Ghost in development, you don’t have to specify any environment, because development is default. To test Ghost in production, you can use:
config.development.json so you can use both at the same time.
Debugging the configuration outputStart Ghost with:Running Ghost with config env variablesALL configuration options are overridable with environment variables! Values set through env vars take priority over data in configuration filesStart Ghost using environment variables which match the name and case of each config option: Configuration optionsThere are a number of configuration options which are explained in detail in this article. Below is an index of all configuration options:
URL(Required in production) Once a Ghost publication is installed, the first thing to do is set a URL. When installing usingghost-cli, the install process requests the URL during the setup process.
Enter the URL that is used to access your publication. If using a subpath, enter the full path, https://example.com/blog/. If using SSL, always enter the URL with https://.
SSLWe always recommend using SSL to run your Ghost publication in production. Ghost has a number of configuration options for working with SSL, and securing the URLs for the admin/ghost/ and the frontend of your publication. Without SSL your username and password are sent in plaintext.
ghost-cli prompts to set up SSL during the installation process. After a successful SSL setup, you can find your SSL certificate in /etc/letsencrypt.
If you see errors such as access denied from url, then the provided URL in your config file is incorrect and needs to be updated.
Database(Required in production) Ghost is configured using MySQL by default:Number of connectionsIt’s possible to limit the number of simultaneous connections using the pool setting. The default values are a minimum of 2 and a maximum of 10, which means Ghost always maintains two active database connections. You can set the minimum to 0 to prevent this:SSLIn a typical Ghost installation, the MySQL database will be on the same server as Ghost itself. With cloud computing and database-as-a-service providers you might want to enable SSL connections to the database. For Amazon RDS you’ll need to configure the connection with"ssl": "Amazon RDS":
\n (you can get the single line string with awk '{printf "%s\\n", $0}' CustomRootCA.crt) and add it to the configuration:
Some hosting providers block outbound SMTP. DigitalOcean blocks ports 25, 465 and 587 on all Droplets by default, and Google Cloud blocks port 25 on Compute Engine instances. If the port your mail config resolves to is one of the blocked ones, transactional email fails with a connection timeout until you switch to a port your provider allows — see DigitalOcean and Google Cloud. Configuring with MailgunMailgun is a service for sending emails and provides more than adequate resources to send bulk emails at a reasonable price. Find out more about using Mailgun with Ghost here. Mailgun allows you to use your own domain for sending transactional emails. Otherwise, you can use a subdomain that Mailgun provides you with (also known as the sandbox domain, limited to 300 emails per day). You can change this at any time. Mailgun is an optional service for sending transactional emails, but it is required for bulk mail — read more.Create a Mailgun accountOnce your site is fully set up create a Mailgun account. After your account is verified navigate to Domain settings under Sending in the Mailgun admin. There you’ll find your SMTP credentials.![]() Add credentials to
Open your production config file in any code editor and add the following mail configuration, making sure to update the values to the same credentials shown in your own Mailgun SMTP settings:
|
| Email type | Address used | Examples |
|---|---|---|
| Member notifications | Support, Default | Signup/sign links, comment replies |
| Newsletters | Newsletter, Default | Configurable per newsletter |
| Staff notifications | Default | Recommendations, signups |
"admin": {
"url": "http://example.com"
}
"server": {
"host": "127.0.0.1",
"port": 2368
}
{{ghost_head}} so your content can be recognised by search engines and social networks."privacy": {
"useTinfoil": true
}
"privacy": {
"useGravatar": false,
"useStructuredData": false,
"useIndexNow": false
}
"security": {
"staffDeviceVerification": false
}
"paths": {
"contentPath": "content/"
},
no-referrer-when-downgrade is the default. Read through all possible options.
storage, caching, sso, and scheduling.
Use the adapters configuration block with “storage”, “caching”, “sso,” or “scheduling” keys to initialize a custom adapter. For example, the following configuration uses storage-module-name to handle all storage capabilities in Ghost. Note that the active key indicates a default adapter used for all features if no other adapters are declared.
"adapters": {
"storage": {
"active": "storage-module-name",
"storage-module-name": {
"key": "value"
}
}
}
cache adapter only for the imageSizes feature, configure the cache adapter as follows:
"adapters": {
"cache": {
"custom-redis-cache-adapter": {
"host": "localhost",
"port": 6379,
"password": "secret_password"
},
"imageSizes": {
"adapter": "custom-redis-cache-adapter",
"ttl": 3600
}
}
}
custom-redis-cache-adapter only for the imageSizes cache feature with these values:
{
"host": "localhost",
"port": 6379,
"password": "secret_password",
"ttl": 3600
}
content/images or an alternative custom content path that’s been configured.
To use a custom storage adapter, your custom configuration file needs to be updated to provide configuration for your new storage module and set it as active:
"storage": {
"active": "my-module",
"my-module": {
"key": "abcdef"
}
}
images - storage of image files uploaded through POST '/images/upload' endpointmedia - storage of media files uploaded through POST '/media/upload' and POST/media/thumbnail/upload endpointsfiles - storage of generic files uploaded through POST '/files/upload' endpointS3Storage adapter that stores files in Amazon S3 or any S3-compatible provider like MinIO, Google Cloud Storage, or Cloudflare R2. You don’t need to install anything extra.
You can set adapters per feature, so media and files can live in S3 while images stay on local storage. There’s no need to move everything at once.
Share a single S3Storage block and point each feature at its fixed prefix with staticFileURLPrefix (see the table below for the values). If your CDN host differs from your site’s domain, also set the matching urls values:
"storage": {
"active": "S3Storage",
"media": {
"adapter": "S3Storage",
"staticFileURLPrefix": "content/media"
},
"files": {
"adapter": "S3Storage",
"staticFileURLPrefix": "content/files"
},
"S3Storage": {
"bucket": "my-ghost-bucket",
"region": "us-east-1",
"cdnUrl": "https://cdn.example.com",
"staticFileURLPrefix": "content/images",
"accessKeyId": "AKIA...",
"secretAccessKey": "...",
"multipartUploadThresholdBytes": 52428800,
"multipartChunkSizeBytes": 10485760
}
},
"urls": {
"image": "https://cdn.example.com/content/images",
"media": "https://cdn.example.com/content/media",
"files": "https://cdn.example.com/content/files"
}
urls.image, urls.media, and urls.files to the public base URL each feature is served from. Without them, Ghost won’t treat CDN-hosted assets as its own: it won’t generate responsive image sizes, and it stores the full CDN URL in your content instead of the portable __GHOST_URL__ form, which breaks if the CDN host later changes.
| Option | Required | Description |
|---|---|---|
bucket | Yes | Name of the S3 bucket. Stored files must be publicly readable, either directly or through your CDN, since Ghost serves them from cdnUrl. |
cdnUrl | Yes | Public base URL that stored files are served from (your CDN or the bucket’s public URL). Ghost builds each file’s public URL from this value. |
staticFileURLPrefix | Yes | Path prefix in the bucket that files are stored under. Use the feature’s fixed prefix: content/images, content/media, or content/files. Ghost matches these when building and resolving URLs, so they aren’t free-form. Responsive image sizes only work when images use content/images. |
multipartUploadThresholdBytes | Yes | Files at least this size (in bytes) are uploaded using S3 multipart upload. |
multipartChunkSizeBytes | Yes | Size (in bytes) of each multipart part. Must be at least 5 MiB (5242880). |
region | No | Region of the bucket. Not required by all providers, but Amazon S3 needs it. |
endpoint | No | Custom endpoint URL. Set this for any S3-compatible provider other than Amazon S3. |
forcePathStyle | No | Use path-style URLs (endpoint/bucket/key) instead of virtual-hosted-style. Required by some S3-compatible providers. |
tenantPrefix | No | Prefix added to every stored object key, for sharing one bucket across multiple sites. |
accessKeyId | No | Access key ID. Must be supplied together with secretAccessKey. If both are omitted, Ghost falls back to the ambient AWS credential chain (environment variables, instance role, etc.). |
secretAccessKey | No | Secret access key. Must be supplied together with accessKeyId. |
sessionToken | No | Temporary session token to accompany the access key pair when using short-lived credentials. |
/content/images/size/w600/..., and expects those URLs to resolve. It can only generate a resized image when the request passes through Ghost itself. If images are served straight from a CDN, those resized paths won’t exist in your bucket unless something else creates them. Put a resizing layer in front of the bucket, such as imgproxy or a CDN that can resize images on the fly. Ghost doesn’t manage that layer for you.content/images, content/media, and content/files into the bucket under the same prefixes first, or previously uploaded assets will 404.storage inside content/adapterscontent/adapters/storage, create a file or a folder: content/adapters/storage/my-module.js or content/adapters/storage/my-module — if using a folder, create a file called index.js inside it.const BaseAdapter = require('ghost-storage-base');
class MyCustomAdapter extends BaseAdapter{
constructor() {
super();
}
}
module.exports = MyCustomAdapter;
save - The .save() method stores the image and returns a promise which resolves the path from which the image should be requested in future.exists - Used by the base storage adapter to check whether a file exists or notserve - Ghost calls .serve() as part of its middleware stack, and mounts the returned function as the middleware for serving imagesdeletereadconst BaseAdapter = require('ghost-storage-base');
class MyCustomAdapter extends BaseAdapter{
constructor() {
super();
}
exists() {
}
save() {
}
serve() {
return function customServe(req, res, next) {
next();
}
}
delete() {
}
read() {
}
}
module.exports = MyCustomAdapter;
get helpers. Note that this adapter requires Redis to be set up and running in addition to Ghost.
To use the Redis cache adapter, change the value for the cache adapter from “Memory” to “Redis” in the site’s configuration file. In the following example, image sizes and the tags Content API endpoint are cached in Redis for optimized performance.
"adapters": {
"cache": {
"imageSizes": {
"adapter": "Redis",
"ttl": 3600,
"keyPrefix": "image-sizes:"
}
}
},
ttl value is in seconds.
imageSizes feature supports full customization. Configuration is as follows:
"cache": {
"imageSizes": "my-cache-module",
"my-cache-module": {
"key": "cache_module_value"
}
}
cache block should have 2 items:
"imageSizes", which contains the name of your custom caching modulekey that reflects the name of your caching module, containing any config your module needscache inside content/adapterscontent/adapters/cache, create a file or a folder: content/adapters/cache/my-cache-module.js or content/adapters/cache/my-cache-module - if using a folder, create a file called index.js inside it.const BaseCacheAdapter = require('@tryghost/adapter-base-cache');
class MyCustomCacheAdapter extends BaseCacheAdapter{
constructor() {
super();
}
}
module.exports = MyCustomCacheAdapter;
get - fetches the stored value based on the key value (.get('some_key')). It’s an async method - the implementation returns a Promise that resolves with the stored value.set - sets the value in the underlying cache based on key and value parameters. It’s an async method - the implementation returns a Promise that resolves once the value is stored.keys - fetches all keys present in the cache. It’s an async method — the implementation returns a Promise that resolves with an array of strings.reset - clears the cache. This method is not meant to be used in production code - it’s here for test suite purposes only.const BaseCacheAdapter = require('@tryghost/adapter-base-cache');
class MyCustomCacheAdapter extends BaseCacheAdapter {
constructor(config) {
super();
}
/**
* @param {String} key
*/
async get(key) {
}
/**
* @param {String} key
* @param {*} value
*/
async set(key, value) {
}
/**
* @returns {Promise<Array<String>>} all keys present in the cache
*/
async keys() {
}
/**
* @returns {Promise<*>} clears the cache. Not meant for production
*/
async reset() {
}
}
module.exports = MyCustomCacheAdapter;
"logging": {
"path": "something/",
"useLocalTime": true,
"level": "info",
"rotation": {
"enabled": true,
"count": 15,
"period": "1d",
"useLibrary": true,
"threshold": "10m",
"totalSize": "100m",
"gzip": true,
"rotateExisting": true
},
"transports": ["stdout", "file"]
}
levelinfo which prints all info, warning and error logs. Set it to error to only print errors.
rotationrotation key:
useLibrary (boolean): Set to true to enable the advanced file rotation library (using a rotating file stream instead of classical time-only Bunyan rotation). Note that configuring any of threshold, gzip, or rotateExisting automatically defaults useLibrary to true.threshold (string): Limit the size of a log file before rotating it, e.g., "10m" (10 Megabytes) or "500k".totalSize (string): Limit the total size cap of all rotated log files, e.g., "100m" or "1g".gzip (boolean): Set to true to compress rotated log files using gzip.rotateExisting (boolean): Set to true to rotate an existing log file on startup when it would have rotated according to the configured period.transportspathcontent/logs/. Set any path but ensure the permissions are correct to write into this folder.
useLocalTimefalse.
caching configuration is available for responses containing public value in Cache-Control header. Each key under caching section contains maxAge property that controls the max-age value in Cache-Control header. For example, the following configuration:
"caching": {
"contentAPI": {
"maxAge": 10
}
}
Cache-Control: public, max-age=10 header with all Content API responses, which might be useful to set for high-volume sites where content does not change often.
The following configuration keys are available with default maxAge values:
"maxAge": 0, controls responses coming from public Ghost pages (like the homepage)"maxAge": 0, controls responses coming from Content API"maxAge": 3600, controls responses for robots.txt files"maxAge": 3600, controls responses for sitemap.xml files"maxAge": 86400, controls responses for sitemap.xsl files"maxAge": 86400, controls responses coming from */.wellknown/* endpoints"maxAge": 86400, controls responses for OPTIONS CORS requests"maxAge": 31536000, controls responses for public assets like public/ghost.css, public/cards.min.js, etc."maxAge": 31536000, controls 301 redirect responses"maxAge": 31536000, controls redirects coming from custom redirects"compress": true. Alternatively, you can turn it off with "compress": false.
config.[env].json file using:
"imageOptimization": {
"resize": false
}
_o.
"opensea": {
"privateReadOnlyApiKey": "..."
}
"klipy": {
"apiKey": "..."
}
"twitter": {
"privateReadOnlyToken": "..."
}

"url": false.
"portal": {
"url": "https://cdn.jsdelivr.net/npm/@tryghost/portal@~{version}/umd/portal.min.js"
}
"url": false.
"sodoSearch": {
"url": "https://cdn.jsdelivr.net/npm/@tryghost/sodo-search@~{version}/umd/sodo-search.min.js",
"styles": "https://cdn.jsdelivr.net/npm/@tryghost/sodo-search@~{version}/umd/main.css"
},
"url": false.
"comments": {
"url": "https://cdn.jsdelivr.net/npm/@tryghost/comments-ui@~{version}/umd/comments-ui.min.js",
"styles": "https://cdn.jsdelivr.net/npm/@tryghost/comments-ui@~{version}/umd/main.css"
}
maxDefinitions:
"members": {
"metafields": {
"maxDefinitions": 200
}
}
0 stops new custom fields from being created. A limit lower than the number of fields a site already has keeps the existing fields, but no more can be added until enough are deleted. If the value isn’t a whole number of 0 or more, Ghost uses the default.