There are two main steps to install Ghost in a subdirectory. You need to update the Ghost config so it knows it is in a subdirectory, and then use apache or nginx to point the right traffic to Ghost

To tell Ghost where it should live, in the config.js file, just add your desired subdirectory name to the end of the production URL. For an example see the following screenshot:

With that example, your Ghost blog would be reachable at http://your-url.com/blog/ . Now you just need to configure your web server to proxy requests that are for http://your-url.com/blog/ to Ghost.

Ghost Subdirectory with Nginx

To have Nginx proxy requests for our /blog/ subdirectory, we need to make a configuration change to the Nginx conf file. For most setups, this config file is located in /etc/nginx/sites-enabled/ . We will be adding onto what already exists in your configuration file.

Since we want to proxy all traffic from /blog to Ghost, we set that as the location and proxy traffic to port 2368. Here is what that looks like:

server { listen 80; server_name localhost; location ^~ /blog { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:2368; proxy_redirect off; } }

Once you have added that to the configuration file, you can restart Nginx with sudo service nginx restart . Now, if you make a request to your base URL, Nginx will serve the default website, but if you added on /blog/ to your URL, you will be served your Ghost blog.

Ghost Subdirectory with Apache

Similar to Nginx, to make Ghost and Apache work together we need to edit the Apache conf file. This is typically located at /etc/httpd/conf/httpd.conf .

Here is what you want to add on:

<IfModule mod_proxy.c> ProxyPreserveHost On ProxyPass /blog/ http://127.0.0.1:2368/blog/ ProxyPassReverse /blog/ http://127.0.0.1:2368/blog/ </IfModule>

Restart apache with apachectl graceful .