1

我是 nginx、Ghost 和管理服务器的新手,如果不指定端口,我无法弄清楚如何让 ghost 运行:2368

http://blog.ingledow.co.uk:2368有效,但http://blog.ingledow.co.uk无效。

我的数字海洋水滴上有两个站点,其中包含两个 .conf 文件/etc/nginx/sites-enabled/。这些是ghost.confingledow.co.uk

顺便说一下,目录/etc/nginx/conf.d/是空的。

Ghost 的 config.js

// ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://blog.ingledow.co.uk',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '146.185.179.133',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    }

/etc/nginx/nginx.conf

http {
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

/etc/nginx/sites-enabled/ghost.conf

server {
    listen 80;
    server_name blog.ingledow.co.uk;

    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
        proxy_buffering off;
    }
}
4

2 回答 2

2

配置好像没问题,但是我觉得你config.js文件里的主机地址应该是127.0.0.1.

server: {
        // Host to be passed to node's `net.Server#listen()`
        host: '127.0.0.1',
        // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
        port: '2368'
    }
于 2014-01-27T14:30:03.107 回答
0

我遇到了类似的问题,这是因为最初我更改了 Ghost config.js 文件以使用我的服务器的 IP 地址和域名,以便我可以通过 IP:2368 和域名访问它。一旦成功,我想将 nginx 设置为侦听端口 80 并重定向到端口 2368。但是,一旦您设置了 nginx,它将在服务器 IP 的端口 80 上侦听,因此您需要重定向到 Ghost,这应该设置为 localhost 地址 127.0.0.1,而不是您的服务器的 IP,并且端口应该是 2368(如果还没有的话)。冰川

于 2014-05-25T19:10:29.363 回答