我在运行的Digital Ocean服务器上有2个Ghost博客:
> Ubuntu 14.04.3 LTS
> Nginx 1.4.6(Ubuntu)
>节点v0.12.7
我使用instructions provided by Digital Ocean来设置博客,他们之前工作得很好并且幸存下来.
昨晚,我将博客#1从Ghost v0.6.0升级到0.7.0并没有遇到任何问题.升级之后,我运行了服务ghost- {blog1}重新启动,它在线与盛况和胜利.
我立即尝试按照相同的步骤升级博客#2,但是当我在重新启动服务后在浏览器中打开它时,我收到了“502 Bad Gateway”错误.
我发现npm无法正确安装sqlite3并修复了它.现在,我可以通过运行npm start –production成功启动博客.终端显示Ghost正在运行并拦截请求,我可以在浏览器中使用该站点和博客应用程序.
但是当我运行服务ghost- {blog2}启动时,它会继续失败而不会出现终端错误.我收到以下消息:
ghost-{blog2} start/running,process 1693
但我仍然在浏览器中看到“502 Bad Gateway”错误.
编辑:我更改了我的启动脚本以运行npm start –production> ghost- {blog2} .log而不是npm start –production,我可以看到Ghost启动,然后立即退出而没有错误:
> ghost@0.7.0 start /var/www/{blog2}/ghost
> node index
这就是日志中的所有内容,即使在几次点击页面之后也是如此. Nginx记录请求,但Ghost没有.
相比之下,当我通过运行npm start –production>启动博客时来自终端的ghost- {blog2} .log,日志继续如下:
> ghost@0.7.0 start /var/www/{blog2}/ghost
> node index
Migrations: Up to date at version 004
Ghost is running in production...
Your blog is now available on http://{blog2}
Ctrl+C to shut down
{{Requests}}
任何人都可以建议我可以采取的步骤来排除故障吗?
编辑:以下是每个博客的相关配置详细信息.
博客#1:这是有效的
/var/www/{blog1}/config.js
production: {
url: 'http://{blog1}',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: '127.0.0.1',// Port to be passed to node's `net.Server#listen()`,for iisnode set this to `process.env.PORT`
port: '2369'
}
},
在/ etc / Nginx的/启用的站点 – / {} blog1
server {
listen 80;
server_name {blog1};
root /usr/share/Nginx/html;
index index.html index.htm;
client_max_body_size 10G;
location / {
proxy_pass http://localhost:2369;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
/etc/init/ghost-{blog1}.conf
# ghost-{blog1}
start on startup
script
cd /var/www/{blog1}
npm start --production
end script
博客#2:当我开始使用npm start –production时,这个工作正常,但当我作为服务启动时失败
/var/www/{blog2}/ghost/config.js
production: {
url: 'http://{blog2}',for iisnode set this to `process.env.PORT`
port: '2777'
}
},
在/ etc / Nginx的/启用的站点 – / {} blog2
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name {blog2};
root /usr/share/Nginx/html;
index index.html index.htm;
client_max_body_size 10G;
location / {
proxy_pass http://localhost:2777;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
/etc/init/ghost-{blog2}.conf
# ghost-{blog2}
start on startup
script
cd /var/www/{blog2}/ghost
npm start --production > ghost-{blog2}.log
end script