How to change subdomain - blog.app.com to main domain subdirectory - app.com/blog for a Ghost CMS self hosted site?

20 Views Asked by At

I am new to technical architecture and domains. I have a Ghost CMS self-hosted website and is hosted on Netlify with a subdomain name like this: blog.app.com

However, I want to change it to as a subdirectory under the main domain (which is also hosted on Netlify) like this: app.com/blog.

How can I do this?

I installed Ghost CMS on a EC2 instance and provided subdomain details via Netlify, and the main domain is created using Webflow and hosted on Netlify.

What are the steps required to do the change?

Please refer:

Using config.production.json for - EC2 Ghost CMS:
"{
"url": "https://blog.app.com",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "hidden",
    "connection": {
      "host": "hidden",
      "user": "hidden",
      "password": "hidden",
      "database": "hidden"
    }
  },
  "mail": {
    "transport": "SMTP",
    "options": {
      "service": "hidden",
      "auth": {
        "user": "hidden",
        "pass": "hidden"
      }
    }
  },
"logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/app/content"
  }
}

This is the NGINX configuration:

server {
    listen 80;
    listen [::]:80;

    server_name blog.app.com;
    root /var/www/app/system/nginx-root;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2368;

    }

    ...
}
0

There are 0 best solutions below