Getting a 404 error on website, the shell says it's running fine

  • ghost.loglotdev.com

  • Ghost-CLI version: 1.25.3

  • Ghost version: 5.75.3

  • How was Ghost installed and configured?
    official steps mixed with some troubleshooting from online

  • What Node version, OS & browser are you using?
    Node - 18.12.1
    OS;
    ==> PC - windows
    ==> SERVER - ubuntu
    Browser - chrome

  • What errors or information do you see in the console?
    none! is says it’s running perfectly

  • What steps could someone else take to reproduce the issue you’re having?
    Absolutely no clue!

The 404 page is generated by Nginx not Ghost, so this suggests that the Nginx configuration is incorrect. Moreover, the connection is insecure.

Therefore, please confirm the steps (guide) you followed to install Ghost, and post the relevant file from /etc/nginx/sites-available plus your Ghost config file.

I’m on my phone so I can’t access the log files now, but here is the guide I used. How to install & setup Ghost on Ubuntu 20.04 or 22.04

Ghost Config File - config.production.json

{
  "server": {
    "port": 2369,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "[redacted]",
      "password": "[redacted]",
      "database": "[redacted]"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/loglotdev/content"
  }
}

nginx config file for website - ghost.loglotdev.com.conf

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

    server_name ghost.loglotdev.com;
    root /var/www/loglotdev/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

    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;

    }

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

    client_max_body_size 50m;
}

/var/www/loglotdev/system/nginx-root

this folder has nothing in it

Your Nginx configuration is using the wrong port for Ghost. Change this to 2369, and restart Nginx.

sudo nginx reload

Since you posted your credentials, you should change these. Likewise, I recommend installing SSL.

ghost setup ssl

yeah, that makes sense, would you be able to tell me how to do that quickly? i think i can do the rest

nginx: invalid option: “reload”

edit, needed to add -s

This should work.

UPDATE mysql.user SET user='new_userid',
 password=PASSWORD('new_password') WHERE user='root';
 FLUSH PRIVILEGES;

Then update your configuration.

Sorry, yes I missed the switch: nginx -s reload .

i did that and it still gives that 404

new config;

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

    server_name ghost.loglotdev.com;
    root /var/www/loglotdev/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

    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 50m;
}

Comment out the root ... line, and reload.

still a 404,

new config;

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

    server_name ghost.loglotdev.com;
    #root /var/www/loglotdev/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

    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 50m;
}

You don’t appear to have the subdomain setup in Ghost. Do this.

ghost setup url http://ghost.loglotdev.com/
ghost restart

still a 404

  "url": "http://ghost.loglotdev.com",
  "server": {
    "port": 2369,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "[redacted]",
      "password": "[redacted]",
      "database": "[redacted]"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/loglotdev/content"
  }
}

Your configs look correct, although I’d remove the following since you aren’t using SSL.

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

And, have you set up a default server in Nginx, i.e., is there more than one symbolic link in /etc/nginx/sites-enabled?

there is a “default” file that i didn’t make, here is the un commented parts, because most of it is commented

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;
        server_name _;
        location / {
                try_files $uri $uri/ =404;
        }
}

Try unlinking this file in /etc/nginx/sites-enabled and reload the configuration.

so, rm default?

20 char minimum

That will work, but make sure you specify the correct directory. Alternatively, unlink /etc/nginx/sites-enabled/default.