Adding ads.txt self hosted ghost with nginx

This is a bit tricky, I tried downloading the template and adding a ads.txt then reupload it... Doesn't work... I tried just creating a ads.txt on the template folder... Doesn't work. Not to forget after adding / update run command ghost restart... Still doesn't work. (maybe cached so maybe you need to try incognito)

Well what works for me is adding this piece of line from the nginx config of the site that is

location ~ ^/ads.txt {
  root /var/www/static/sitename;
}

so what I did was making a separate folder just for static then add the ads.txt there, Now it works.

Changing http to https

This is surprisingly easy, although had a trouble on upgrading self ghost cli (turns out you didn't had to).

ghost setup nginx ssl
ghost restart

The command above created a new nginx conf, it made a bit of mess, it just loop redirects, so a bit of hacking... just copied the generated to the real one for the ssl, the one without ssl just redirect to ssl.

service nginx restart

After Ghost restart, It goes to 502 bad gateway

Just happened to restart then it went 502, after a bit of research it's has to do something with proxy_pass nginx. It shows this error on nginx log.

connect() failed (111: Connection refused) while connecting to upstream

to fix this

netstat -plant

find port that has node in it... on my case the port is different, so I changed it to the active port listener then it works