【问题标题】:Can't run Ghost blog on subdomain without port无法在没有端口的子域上运行 Ghost 博客
【发布时间】:2014-01-26 22:09:57
【问题描述】:

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

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

我的数字海洋水滴上有两个站点,/etc/nginx/sites-enabled/ 中有两个 .conf 文件。这些是ghost.conf 和ingledow.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;
    }
}

【问题讨论】:

  • 不工作是什么意思?白页? 404? 502?

标签: apache nginx ghost-blog


【解决方案1】:

配置好像​​没问题,但是我觉得你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'
    }

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-15
      • 1970-01-01
      相关资源
      最近更新 更多