Ghost-cli & 'Failed to send magic link email' mail setup

Alright so a quick TLDR: I tried to setup mailgun and failed. I found out I couldnt use “ghost restart” so I was just restarting the server completely just to use it as a horrible work around. I tried switching to o365 and it has lead to the now - 502 Bad Gateway, but switching the mail server back to mailgun doesnt really resolve the issues described below except gets rid of the 502.


Tried using ghost restart in the folder that my ghost cli is located and it doesnt work. no ghost command works. my isp says its because ghost cli was not installed correctly but i must admit im not sure how to check or troubleshoot this issue. I am with hostinger and part of their vps packages allow you to single install ghost on an ubuntu server during setup of the vps which i did. so i assumed the root of the web files (where the cli file is located) is where the ghost instance is. so if i cd into that file path it should work?

Info dump from the log:

root@defiantlegends:/home/user/htdocs/ ghost restart
Command 'ghost' not found, did you mean:
  command 'gost' from snap gost (2.11.5)
  command 'rhost' from deb jdresolve (0.6.1-5.1)
  command 'qhost' from deb gridengine-client (8.1.9+dfsg-10build1)
  command 'host' from deb bind9-host (1:9.18.18-0ubuntu0.22.04.1)
  command 'khost' from deb knot-host (3.1.6-1ubuntu1)
  command 'gost' from deb gost (0.1.0+git20181204.5afeda5e-1.1ubuntu0.22.04.2)
  command 'xhost' from deb x11-xserver-utils (7.7+9build1)
  command 'gfhost' from deb gfarm-client (2.7.17+dfsg-1build2)
See 'snap info <snapname>' for additional versions.

Also getting a ‘Failed to send magic link email’ when attempting to test out the subscribe button. Many sources on here say to use mailgun, but I also just found another saying they opted for google, is there a way I can use outlook (office365) as they are my domain emailing provider? I setup mailgun temporarily but i realize that isnt a viable way for my project type.

This was in my config.production.json:

"mail": {
  "transport": "SMTP",
  "options": {
    "service": "Mailgun",
    "host": "",
    "port": 587,
    "secure": true,
    "auth": {
      "user": "",
      "pass": "*****"

Below snippet leads to 502 bad gateway:

"mail": {
  "transport": "SMTP",
  "options": {
    "from": "",
    "service": "o365",
    "host": "",
    "port": 587,
    "secure": true,
    "auth": {
      "user": "*****",
      "pass": "********"

This is all ive got in my ghost.log:

- Inspecting operating system
- Checking for deprecations

[14:40:33] Checking system Node.js version [started]
[14:40:33] Checking system Node.js version - found v18.20.2 [title changed]
[14:40:33] Checking system Node.js version - found v18.20.2 [completed]
[14:40:33] Ensuring user is not logged in as ghost user [started]
[14:40:33] Ensuring user is not logged in as ghost user [skipped]
[14:40:33] Checking if logged in user is directory owner [started]
[14:40:33] Checking if logged in user is directory owner [skipped]
[14:40:33] Checking current folder permissions [started]
[14:40:33] Checking current folder permissions [completed]
[14:40:33] Validating config [started]
[14:40:33] Validating config [completed]
[14:40:33] Checking memory availability [started]
[14:40:33] Checking memory availability [completed]
[14:40:34] Checking binary dependencies [started]
[14:40:34] Checking binary dependencies [completed]
- Starting Ghost: defiantlegends-com
✔ Starting Ghost: defiantlegends-com

Try changing the user to