How install Ghost in a subfolder

Find out how to install Ghost in a subfolder like /ghost following this 2 simple steps

How install Ghost in a subfolder

In order to install Ghost in a subfolder like this blog just follow the 2 simple steps ahead, pretty straightforward! 👇

Set the URL

When you're installing Ghost

When you are installing Ghost with the command:

ghost install

It will ask for the blog URL, so enter the full path including the subfolder

For example:

And continue your installation.

Already have a Ghost blog running and wish to move to a subfolder? 👇

  • Edit your Ghost config file, usually located at /var/www/ghost/config.production.json
  • Update the first variable called url and set the new one with the subfolder
  • Restart Ghost running ghost restart
  • Continue to the next step called Updating Nginx
    ⚠️ Consider this may should apply additional steps like redirect old URLs to the new ones for SEO

Updating NGINX

So if you are moving Ghost to a subfolder means you have something at the domain root, like another website or app.

As most web servers are running NGINX will show you how do this job with it.

Edit the config file, usually located at /etc/nginx/nginx.conf or /etc/nginx/sites-enabled/

💡 You can edit it via FTP or SSH

Search for a server block that contains your domain like:

server {
  # ...
  # ...

Inside it you should create or update a location block for /blog like the following:

server {
  # ...
  # ...
  location ^~ /blog {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;

💡 If your blog is running in a different server where NGINX is running, change the IP to your Ghost blog server IP

Finally restart NGINX running in the console:

sudo systemctl restart nginx

👏 It's done!

Now your Ghost blog should be available in the URL with the subfolder like

💡 Remember your Ghost admin will be available in the same URL but adding /ghost at the end like

More info Ghost Setup Guide

Write your Ghost blog success 🚀

Give a try to Ghostboard without any risk: start now your 14 days free trial without credit card, check it out by yourself 🙂

Happy to help you and answer any question, tweet us or contact in your dashboard! 👋