0

尝试在节点为 0.10 的 Digital Ocean Droplet 上安装 Ghost 0.4.2 时遇到问题。我使用了 Dokku Droplet(而不是他们的 Ghost 设置),因为我想安装具有不同域的多个节点应用程序。

我 git 克隆了稳定的 Ghost 版本,并按照他们给出的说明进行设置:

npm install -g grunt-cli
npm install
grunt init (and grunt prod if you want to run Ghost in production mode)
npm start

我已将 config.js 文件(生产部分)更改为

    url: 'http://mydomain.co',  
    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: '0.0.0.0',
        // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
        port: '2368'

当我使用端口 2368 时,它显示“Ghost 正在运行……您的博客现在可以在http://mydomain.co上访问”

但随后它在页面上给了我一个 nginx 502 错误。

好的,当我将生产端口更改为 80(一篇文章建议这样做)时,它会抛出此错误:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
    at net.js:1143:9
    at dns.js:72:18
    at process._tickDomainCallback (node.js:459:13)
    at process._tickFromSpinner (node.js:390:15)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

我猜这意味着该端口已经在使用中。

如何设置正确的端口?

好的,这是我不明白的另一部分。许多网站提到尝试“sudo service ghost restart”。我总是对此感到“幽灵:无法识别的服务”。这很奇怪,因为一切都已准备就绪,并且他们提供的开发人员说明(见顶部)非常适合安装它。但我的系统不知道它的存在。

此外,似乎没有任何 /var/www/ghost 文件。不确定那是什么意思。

我已经侦探和谷歌搜索,但似乎无法弄清楚这一点。任何提示或提示将不胜感激。

4

1 回答 1

1

EADDRINUSE - 当此端口被另一个应用程序使用时会出现此错误。将配置中的端口返回到 2368。

然后编辑你的配置文件

 nano /etc/nginx/sites-available/default

您需要添加上游和proxy_pass。

在文件顶部:

upstream ghost {
    server localhost:2368;
}

然后在服务器路径中:

location / { 
    proxy_pass http://ghost;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
}
于 2014-05-10T01:09:24.070 回答