502 error even though blog is running


#1

SO every time i go to my sit samgrogan.tk it shows a 502 bad gateway. But when I run ghost ls its shows that the blog is running. So the trouble shooting on ghosts website for the error isnt helpful. I’m not sure what to do next to continue my debugging.


#2

Could you please provide some context for your setup? Are you running the reccommended stack without any deviations? If not, what’s different? Are you using Ghost CLI, and if so, what version? Have you made any changes to the configuration files manually?


#3

my cli is version 1.7.1. my original install was from digital oceans one-click install. I had to migrate everything from root to a new user because i couldn’t use the ghost cli from root any more. How do I check my config files again its been a long time since I’ve touched them.


#4

In that case, there’s no need to worry!

Your best bet to find an error is to either use ghost log, or run ghost in the foreground (ghost stop && ghost run).


#5

This is what I have from logs which doesn’t seem to have anything but i could be wrong.

[2018-04-18 04:40:46] INFO Model: User 
[2018-04-18 04:40:46] INFO Model: User 
[2018-04-18 04:40:47] INFO Model: Post 
[2018-04-18 04:40:47] INFO Model: Post 
[2018-04-18 04:40:47] INFO Relation: Role to Permission 
[2018-04-18 04:40:47] INFO Relation: Role to Permission 
[2018-04-18 04:40:48] INFO Relation: Post to Tag 
[2018-04-18 04:40:48] INFO Relation: Post to Tag 
[2018-04-18 04:40:48] INFO Relation: User to Role 
[2018-04-18 04:40:48] INFO Relation: User to Role 
[2018-04-18 04:40:53] WARN Theme's file locales/en.json not found. 
[2018-04-18 04:40:53] WARN Theme's file locales/en.json not found. 
[2018-04-18 04:40:54] INFO Ghost is running in production... 
[2018-04-18 04:40:54] INFO Ghost is running in production... 
[2018-04-18 04:40:54] INFO Your blog is now available on http://samgrogan.tk/ 
[2018-04-18 04:40:54] INFO Ctrl+C to shut down 
[2018-04-18 04:40:54] INFO Your blog is now available on http://samgrogan.tk/ 
[2018-04-18 04:40:54] INFO Ctrl+C to shut down 
[2018-04-18 04:40:54] INFO Ghost boot 3.888s 
[2018-04-18 04:40:54] INFO Ghost boot 3.888s

#6

I forgot to add the error flag to the ghost log command - it should be ghost log -e :no_mouth:


#7

It’s giving me a database migration error. thats the only error


#8

In that case, run ghost setup migrate to ensure your database is up to date!


#9

it ran with out error and then i restarted but still no change


#10

What port does ghost ls show? 2368, 2369…? Is it the same port used in your Ghost’s /var/www/ghost/config.production.json, and also the same port for proxy_pass in your Nginx’s configuration files at /var/www/ghost/system/files/*.conf?


#11

port 2369 let me google how to check those files and ill get back to you


#12

I have no conf file in /var/www/ghost/system/files/ but as for the first one its the same port. the host in the config.production.json should that be the local host?


#13

So maybe you have Ghost installed in a different place, other than the usual /var/www/ghost/. Anyway, there will be symlinks at /etc/nginx/sites-enabled

Yes, 127.0.0.1


#14

You can try for example:

ls /etc/nginx/sites-enabled
cat /etc/nginx/sites-enabled/example.com-ssl.conf

And the rest of .conf files as well. See ports in Nginx’s proxy_pass lines.


#15

well as it turns out i had no nginx config file in sites enabled so i made one and restarted nginx and now its working. awesome


#16

OK, 502 could have been a number of things (configurations, permissions, etc.), but glad it’s working already. :+1:


#17

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