在部署node.js应用程序之后,ghost博客部分会中断

我有一个node.js应用程序,其中一个视图是一个ghost.js博客,我通过遵循Ghost的wiki文章Using Ghost作为npm模块进行了整合。

目前,我的本地版本完美地工作。

错误:

当我访问部署的网站时,一切工作正常,除了当我到mysite.heroku.com/blog ,在这一点上,我得到的鬼页面看起来像 鬼404错误页面

我注意到应用程序有两个同时运行的本地主机分支( localhost:3000localhost:2368/ )。 我不确定这是否会导致错误。 我已经检查了我的Heroku日志,他们没有提供任何比GET请求发送到/blog更多的细节,首先返回301 ,然后是404错误。

另外,知道当我点击Go to front page链接时,它会发送给我http://localhost:2368/

我的config.js文件如下所示:

 var path = require('path'), config; config = { // ### Production // When running Ghost in the wild, use the production environment // Configure your URL and mail settings here production: { url: 'http://example.com/blog', 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: '2368' } }, // ### Development **(default)** development: { // The url to use when providing links to the site, Eg in RSS and email. // Change this to your Ghost blogs published URL. url: 'http://localhost:2368/blog', // Example mail config // Visit http://support.ghost.org/mail for instructions // ``` // mail: { // transport: 'SMTP', // options: { // service: 'Mailgun', // auth: { // user: '', // mailgun username // pass: '' // mailgun password // } // } // }, // ``` database: { client: 'sqlite3', connection: { filename: path.join(__dirname, '/content/data/ghost-dev.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: '2368' }, paths: { contentPath: path.join(__dirname, '/content/') } }, // **Developers only need to edit below here** // ### Testing // Used when developing Ghost to run tests and check the health of Ghost // Uses a different port number testing: { url: 'http://127.0.0.1:2369', database: { client: 'sqlite3', connection: { filename: path.join(__dirname, '/content/data/ghost-test.db') } }, server: { host: '127.0.0.1', port: '2369' }, logging: false }, // ### Testing MySQL // Used by Travis - Automated testing run through GitHub 'testing-mysql': { url: 'http://127.0.0.1:2369', database: { client: 'mysql', connection: { host : '127.0.0.1', user : 'root', password : '', database : 'ghost_testing', charset : 'utf8' } }, server: { host: '127.0.0.1', port: '2369' }, logging: false }, // ### Testing pg // Used by Travis - Automated testing run through GitHub 'testing-pg': { url: 'http://127.0.0.1:2369', database: { client: 'pg', connection: { host : '127.0.0.1', user : 'postgres', password : '', database : 'ghost_testing', charset : 'utf8' } }, server: { host: '127.0.0.1', port: '2369' }, logging: false } }; // Export config module.exports = config; 

它看起来像Ghostconfiguration通过一个config.js文件(请参阅您提供的链接),并且您可能已经为url: 'http://localhost:2368/blog'configurationurl: 'http://localhost:2368/blog' 。 看起来您需要将其更改为您的实际url。

另外,请参阅https://github.com/cobyism/ghost-on-heroku