Suddenly Unable to Completely Start Ghost After Server Restart


#1

Current state of the blog:

2019-01-27%2023_46_14-502%20Bad%20Gateway

Nginx end of things:

2019/01/28 05:32:54 [error] 772#772: *27 connect() failed (111: Connection refused) while connecting to upstream, client: _IP_ADDRESS_, server: _MY_DOMAIN_.com, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:2369/", host: "_MY_DOMAIN_.com

Ghost end of things (ghost run):

[2019-01-28 05:32:13] INFO Ghost is running in production...
[2019-01-28 05:32:13] INFO Your blog is now available on https://_MY_DOMAIN.com/
[2019-01-28 05:32:13] INFO Ctrl+C to shut down
[2019-01-28 05:32:13] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-01-28 05:32:13] WARN Tries: 0
[2019-01-28 05:32:13] WARN Retrying...
[2019-01-28 05:32:13] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-01-28 05:32:13] WARN Tries: 1
[2019-01-28 05:32:13] WARN Retrying...
[2019-01-28 05:32:13] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-01-28 05:32:13] WARN Tries: 2
[2019-01-28 05:32:13] WARN Retrying...
[2019-01-28 05:32:14] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-01-28 05:32:14] INFO Ghost boot 3.07s

Current configuration(s):.

config.production.json

{
  "url": "https://_MY_DOMAIN.com/",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "ghost",
      "password": "CENSORED",
      "database": "CENSORED"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  },
  "bootstrap-socket": {
    "port": 8000,
    "host": "localhost"
  }
}

MYDOMAIN-ssl.conf:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name _MY_DOMAIN_.com;
    root /var/www/ghost/system/nginx-root;

    ssl_certificate /etc/letsencrypt/_MY_DOMAIN_.com/fullchain.cer;
    ssl_certificate_key /etc/letsencrypt/_MY_DOMAIN_.com/_MY_DOMAIN_.com.key;
    include /etc/nginx/snippets/ssl-params.conf;

    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:2369;

    }

    location ~ /.well-known {
        allow all;
    }

    client_max_body_size 62m;
}

MYDOMAIN-.conf:

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

    server_name _MY_DOMAIN_.com;
    root /var/www/ghost/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:2369;

    }

    location ~ /.well-known {
        allow all;
    }

    client_max_body_size 62m;
}

Attempts:

  • I tried killing and searching for all node processes, there were none when ghost wasn’t running.
  • Restarting nginx.
  • No processes appear to be occupying that port.
  • Multiple server restarts.
  • Ghost run, ghost start, ghost restart, ghost stop in every possible order.
  • Updating ghost: Apparently succeeded(?) output:
guser@blog:/var/www/ghost$ ghost upgrade
You are running an outdated version of Ghost-CLI.
It is recommended that you upgrade before continuing.
Run `npm install -g ghost-cli@latest` to upgrade.

+ sudo systemctl is-active ghost_localhost
✔ Checking system Node.js version
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking for available migrations
✔ Checking for latest Ghost version
✔ Downloading and updating Ghost to v2.12.0
✔ Linking latest Ghost and recording versions
+ sudo systemctl is-active ghost_localhost
☱ Downloading and updating Ghost to v2.12.0 > Installing dependencies > [5/5] Building fresh packages...✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
☲ Restarting Ghost✔ Checking current folder permissions
+ sudo systemctl is-active ghost_localhost
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
+ sudo systemctl start ghost_localhost
✔ Restarting Ghost
ℹ Removing old Ghost versions [skipped]
guser@blog:/var/www/ghost$ ghost status
+ sudo systemctl is-active ghost_localhost
┌───────────┬────────────────┬─────────┬──────────────────────┬──────────────────────────────┬──────┬─────────────────┐
│ Name      │ Location       │ Version │ Status               │ URL                          │ Port │ Process Manager │
├───────────┼────────────────┼─────────┼──────────────────────┼──────────────────────────────┼──────┼─────────────────┤
│ localhost │ /var/www/ghost │ 2.12.0  │ running (production) │ https://_MY_DOMAIN_.com/ │ 2368 │ systemd         │
guser@blog:/var/www/ghost$ npm start --production
npm ERR! path /var/www/ghost/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/var/www/ghost/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/guser/.npm/_logs/2019-01-28T05_53_42_695Z-debug.log

Status still the same.


#2

It looks like nginx is trying to connect to port 2369, but your config has ghost listening on 2368. I’m not sure why that would happen, but you can manually fix it by

either

running ghost config set server.port 2369 and restarting ghost (ghost restart),

or

editing your nginx config to use port 2368 and restarting (sudo nginx -s reload)


#3

Not sure how that happened either. Very odd. But that seems to have done the trick! Thank you. I will update if there are any additional issues.


closed #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.