Nginx   发布时间:2022-05-11  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了nginx – 在同一台服务器上升级2个Ghost博客,1作为服务运行时立即退出大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我在运行的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 @R_801_10107@://{Blog2}
Ctrl+C to shut down
{{requests}}

任何人都可以建议我可以采取的步骤来排除故障吗?

编辑:以下是每个博客的相关配置详细信息.

博客#1:这是有效的

/var/www/{Blog1}/config.js

production: {
    url: '@R_801_10107@://{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 @R_801_10107@://localhost:2369;
            proxy_set_header X-ForWARDed-For $proxy_add_x_forWARDed_for;
            proxy_set_header Host $@R_801_10107@_host;
            proxy_set_header X-ForWARDed-Proto $scheR_293_11845@e;
            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: '@R_801_10107@://{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 @R_801_10107@://localhost:2777;
            proxy_set_header X-ForWARDed-For $proxy_add_x_forWARDed_for;
            proxy_set_header Host $@R_801_10107@_host;
            proxy_set_header X-ForWARDed-Proto $scheR_293_11845@e;
            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
最佳答案
我最终删除了ghost的node_modules,然后重新安装了所有内容.

rm -rf node_modules && npm cache clean
npm install --production

sqlite3安装不正确,所以我不得不重新安装它.
这删除了我的数据库,但我有一个备份.

npm install sqlite3

重新启动服务后,一切都恢复了.

service Nginx restart && service ghost restart

大佬总结

以上是大佬教程为你收集整理的nginx – 在同一台服务器上升级2个Ghost博客,1作为服务运行时立即退出全部内容,希望文章能够帮你解决nginx – 在同一台服务器上升级2个Ghost博客,1作为服务运行时立即退出所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: