Ghost在AWS EC2

时间:2017-12-12 10:45:10

标签: amazon-web-services nginx amazon-ec2 ghost-blog ghost

正如您所见,我在ghost start

期间没有收到任何错误

enter image description here

但是当我真正进入页面http://13.125.83.25(EC2实例的弹性IP)时,什么都没有。页面没有加载任何东西。不知道为什么会这样,我是鬼模块的新手。我错过了什么?

这里config.production.json以下。

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

以及此处/etc/nginx/sites-available/default

server {
        listen 80;

        root /var/www/html;

        server_name _;

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

1 个答案:

答案 0 :(得分:1)

您应填写 server_name 附近的 IP /域名,并确保您在 proxy_pass <附近拥有正确的端口 / strong> beacause有时当你运行 ghost restart 时它会更改端口号。因此,为了检查端口号,运行以下命令 ghost ls 并检查正在运行的ghost进程的端口号。使用以下配置为您的Nginx服务器,希望它有所帮助。

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

    server_name 13.125.83.25;
    root /var/www/ghost/system/nginx-root;

    location /blog {
        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;
}