Struggling with fresh install

I’m not really sure where to go from here. Been troubleshooting for a few hours and could use some help :)

  • What’s your URL? new.atarlife.com
  • What version of Ghost are you using?
  • What configuration? Nginx

Ghost version:

  • Ghost-CLI version: 1.13.1
  • Ghost version: 3.11.0
# ghost doctor
✔ Checking system Node.js version
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking operating system compatibility
✔ Checking for a MySQL installation
- sudo systemctl is-active ghost_new-atarlife-com
+ sudo systemctl reset-failed ghost_new-atarlife-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies

# ghost run

+ sudo node current/index.js
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/opt/websites/atarlife/current/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Hey @EBA, what installation steps did you follow?

1 Like

Bounced between two guides:

Nginx (had already installed) + npm

You might want to check out our guide in the docs for Ubuntu:

1 Like

If you’re setting up a fresh droplet on DigitalOcean, the easiest way by far is to use their 1-click image

3 Likes

@Hannah - It’s not a fresh droplet. The droplet has many other sites (most wordpress)

@DavidDarnes - I saw this too. I think the main issue I’m facing with all of the tutorials I’ve tried is that Ghost attempts to auto handle Nginx and I’m not letting. I’d rather handle that process manually as this is a live server. (I’ve already done a test with one click install etc. to play around and want to see what live would look like which is why I’m doing this on prod server)

Thank you both for chiming in! Hoping to figure this out as I’m intrigued by Ghost :slight_smile:

This is the NGINX block:

        listen 80 ;
        listen [::]:80 ;

        #root /var/www/atarlife.com/current;

        server_name new.atarlife.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;

                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header HOST $http_host;
                proxy_set_header X-NginX-Proxy true;

                proxy_pass http://127.0.0.1:2368;
                proxy_redirect off;
        }
}

@EBA can I recommend that you uninstall Ghost and reinstall?

This time, walk us through the steps and the logs from the install. It seems like something went wrong with the install, as Ghost isn’t currently loading but it’s hard to debug after-the-fact.

Once you get past the install part and have Ghost running, you’re also going to need to update your nginx config to match the one Ghost-CLI would produce:

Without SSL: Ghost-CLI/nginx.conf at main · TryGhost/Ghost-CLI · GitHub

With SSL (very strongly recommended)

You’re currently missing critical directives.

1 Like

@Hannah thank you so much for assisting!

We’ll go with SSL once live. Below is yet another attempt at a re-install:

  • I clear out the username and password from image but it was done there as well :slight_smile:

It hangs in the starting Ghost process. Let me know what log/location to check for and I can dive into it and paste it here as well.

Nginx updated with your guidance:
I commented out one step in location that I wasn’t sure about.

        listen 80 ;
        listen [::]:80 ;

        root /var/www/atarlife.com/current;

        server_name new.atarlife.com;

        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;
                #<% if (location !== '/') { %>proxy_redirect off;<% } %>
        }

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

        client_max_body_size 50m;
}

For the nginx part - you can remove the commented line as it’s for sites where location is a subdirectory.

As for installing Ghost, I’ve never seen anything like this so struggling a bit. Something about your setup must be unusual, and it’s obviously something ghost doctor doesn’t know about :thinking:

To start at the beginning, can you go through the prerequisites list and share your installed software versions for each item?

Then can you scroll down and verify that nginx, mysql, node and ghost-cli were all installed in the same way show in the official instructions?

And lastly can you run this command in your ghost install folder and share the result:

find . -maxdepth 2 -exec ls -ald "{}" \;

Screen Shot 2020-03-20 at 15.30.21

ghost run seems to give an error:

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/opt/websites/atarlife/current/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Anybody up for a TeamViewer session? I have literally tried everything I could think of.

  • Uninstall and install node/npm too many times to name
  • Updated all packages on server
  • Did a tutorial on ubuntu permissions cause I felt like it could be related and it’s all new to me.
  • Uninstall and install ghost a gazillion times at this point.

Help???

I think Your problem is between Cloudflare and your hostin ip.
It would appear that it is a subdomain of another site, so this needs particular configuration rules between cloudflare and your hosting. Where are you hosting it?

Could something like DNS issues prevent ghost from starting?

Cloudflare settings have been updated and so was NGNIX. I’ve used Cloudflare for years with various projects and doubt it’s related. But open to trialing anything at this point.

From everything I’ve read in the past few days, Im inclined to believe it’s related to permissions. Specifically, something with the module’s behind nodejs.

This is the only thing that I’m able to find wrong through the ghost process. Everything else is green check marks across.

I focused on this, because a 502 error, as you well know is a “Bad Gateway” error. So it would seem to be more a domain configuration error than a software one.
Unless you have not completed the ghost setup. In that case the site is offline, and would give an error of this type.

I just don’t see how something on Cloudflare could prevent ghost from starting up?

If ghost does’nt well installed, your server could produce that error ¿Could you acces your ghost via ip instead url?

The server is hosting other sites that work fine. Everything on that end seems to be working.

Totally understand but, can you open your ghost install via its own ip? Could you try this?