Port already in use by another program (Digital Ocean)

I’m running Ghost on a Digital Ocean install.

I’ve hit a problem where I can’t start/stop Ghost because of this 500 Error caused by a port already in use by another program.

I’ve tried a bunch of things, but just can’t resolve this.

Any pros in here got a few tips or things I could try?

{
    "name": "Log",
    "hostname": "ghost-ubuntu-c-2-4gib-nyc1-01",
    "pid": 2838615,
    "level": 50,
    "err":
    {
        "id": "...",
        "domain": "https:...",
        "code": null,
        "name": "InternalServerError",
        "statusCode": 500,
        "level": "critical",
        "message": "(EADDRINUSE) Cannot start Ghost.",
        "context": "\"Port 2371 is already in use by another program.\"",
        "help": "\"Is another Ghost instance already running?\"",
        "stack": "InternalServerError: (EADDRINUSE) Cannot start Ghost.\n   ...",
        "hideStack": false
    },
    "msg": "(EADDRINUSE) Cannot start Ghost.",
    "time": "2023-03-15T00:46:12.852Z",
    "v": 0
}

Change the port in config.production.json, and restart Ghost. You’ll also need to change the proxy settings in Nginx.

However, it would make sense to understand what the other service is; it could be another Ghost site running. What’s the output from ghost ls?

1 Like

Thanks for the tip. I managed to do that, and a whole bunch of other things.

I’ve given up though. Site has been running for about 5 years now and it’s died. Have spent on/off about 2 months trying to solve:

  • no matter what port I reassign to, Ghost instantly throws error saying that one is in use.
  • can’t update or do anything related to ghost command
  • ghost doctor says everything ok
  • when you ghost ls it says there are no instances running, but the site is live and working :person_shrugging: .

I think it’s time to cut my losses and start again. It’s been a good run.