【问题标题】:Ghost gives me 404 error on AWS EC2Ghost 在 AWS EC2 上给了我 404 错误
【发布时间】:2017-12-12 10:45:09
【问题描述】:

如您所见,ghost start 期间我没有收到任何错误

但是当我实际转到页面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;
        }

【问题讨论】:

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


    【解决方案1】:

    您应该在 server_name 附近填写您的 IP/域名,并确保您在 proxy_passport /strong> 因为有时当您运行 ghost restart 时,它会更改端口号。所以为了检查端口号,请运行以下命令 ghost ls 并检查端口您正在运行的幽灵进程的数量。为您的 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;
    }
    

    【讨论】:

      猜你喜欢
      • 2015-10-18
      • 2021-01-02
      • 1970-01-01
      • 1970-01-01
      • 2012-07-20
      • 2023-01-01
      • 1970-01-01
      • 2021-09-09
      • 2020-10-24
      相关资源
      最近更新 更多