amazon-web-servicesnginxghost-blog

Ghost website not accessible with 404 error after installing Ghost on AWS Ubuntu 20.04


If you're looking for some help, it's important to provide as much context as possible so that people are able to assist you. Try to always mention:

I have created elastic IP following this tutorial:

and a hosted zone on AWS was also created on Route 53, and the name servers have been added to NameCheap on which I bought the domain, they were configured last night and I thought perhaps the DNS takes some time to propagate, but it seems like there are literally some issues.

config.production.json is as below:

{
  "url": "https://vincentyuan.us",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "my_host",
      "user": "my_user",
      "password": "password",
      "database": "my_database",
      "ssl": "Amazon RDS"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/sitename/content"
  }
}

ghost doctor log:


✔ Checking system Node.js version - found v16.20.1
✔ 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 system compatibility
+ sudo systemctl is-active ghost_vincentyuan-us
Instance is currently running
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✖ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v16.20.1
One or more errors occurred.

1) SystemError

Message: You are recommended to have at least 150 MB of memory available for smooth operation. It looks like you have ~111.0390625 MB available.

Debug Information:
    OS: Ubuntu, v20.04.6 LTS
    Node Version: v16.20.1
    Ghost Version: 5.54.0
    Ghost-CLI Version: 1.24.2
    Environment: production
    Command: 'ghost doctor'

Try running ghost doctor to check your system for known issues.

nginx status:

ubuntu@ip-172-31-41-64:/var/www/sitename/current$ service nginx status
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-07-09 03:06:19 UTC; 13h ago
       Docs: man:nginx(8)
   Main PID: 545 (nginx)
      Tasks: 2 (limit: 1141)
     Memory: 3.0M
     CGroup: /system.slice/nginx.service
             ├─545 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─546 nginx: worker process

Jul 09 03:06:19 ip-172-31-41-64 systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 09 03:06:19 ip-172-31-41-64 systemd[1]: Started A high performance web server and a reverse proxy server.

ghost set up ssl also worked:

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org



SSL has already been set up, skipping
ℹ Setting up SSL [skipped]

Solution

  • The issue is with your SSL cert. You are providing a subdomain (www) but your cert is only set for the root domain.

    So this works http://vincentyuan.us/

    But this does not http://www.vincentyuan.us/

    You will need to probably regenerate your certificate to encompass subdomains as well. Depending on how you created your SSL this will vary but the general concept is the same. Here are some docs on CloudFront SSL since you appear to be using then: https://developers.cloudflare.com/ssl/edge-certificates/universal-ssl/