2015-07-01 12 views
5

Ho un'applicazione node.js in cui una delle viste è un blog ghost.js, che ho integrato seguendo l'articolo del wiki di Ghost Using Ghost as an npm module.Dopo aver distribuito l'applicazione node.js la sezione del blog fantasma si interrompe

Attualmente, la mia versione locale funziona perfettamente.

l'errore:

Quando visito il sito schierato, tutto funziona bene, tranne quando ho avuto modo di mysite.heroku.com/blog, a quel punto ho la pagina di fantasma che sembra Ghost 404 Error Page.

Ho notato che l'applicazione ha due rami di localhost che funzionano simultaneamente (localhost:3000 e localhost:2368/). Non sono sicuro che ciò potrebbe causare l'errore. Ho controllato i miei registri Heroku e non forniscono ulteriori dettagli rispetto a una richiesta GET inviata a /blog, restituendo prima un 301 e quindi un errore 404.

Inoltre, potrebbe essere utile sapere che quando clicco sul link Go to front page mi manda a http://localhost:2368/

Il mio file config.js è simile al seguente:

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, E.g. 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; 

risposta

2

Sembra fantasma è configurato tramite un file config.js (consultare il collegamento fornito) e potrebbe essere configurato per url: 'http://localhost:2368/blog'. Sembra che dovrai cambiarlo con il tuo vero URL.

Inoltre, vedono questo https://github.com/cobyism/ghost-on-heroku

+0

ho aggiunto ciò che è incluso nel mio file 'config.js' al codice di cui sopra. – maudulus

+0

Sì, beh, tutti quegli URL nel tuo file di configurazione non funzioneranno. La tua app, se distribuita ovunque, non sarà mai in "localhost". Inoltre, dovresti usare la porta che ti offre Heroku (nella variabile di ambiente PORT) (che associa alla porta 80 a sua volta), non una porta fissa. Infine, non è possibile utilizzare SQLite: difficilmente si adatta a un'app Web in produzione. Vi consiglio di seguire il link al repository GitHub che ho fornito e controllare la loro configurazione. –

+0

Non sono sicuro di seguirmi: le parti 'localhost' del file di configurazione sono in' sviluppo' e 'testing', mentre la parte' production' del codice usa un url. – maudulus

Problemi correlati