sto cercando di eseguire fantasma su una sottodirectory del mio progetto principale Node.js. Attualmente è ospitato in siti Web azzurri.
Qualcosa di simile: http://randomurlforpost.azurewebsites.net/blogRun Ghost in una sottodirectory di mio principale applicazione Node.js
Ho seguito le istruzioni qui: https://github.com/TryGhost/Ghost/wiki/Using-Ghost-as-an-NPM-module
Con la nuova aggiunta di utilizzare fantasma come modulo NPM ho ancora bisogno Nginx o Apache ?. A partire da ora ho il mio sito principale in esecuzione su localhost: 3000 e l'istanza Ghost in esecuzione su localhost: 2368.
Ho provato a fare tutti i tipi di modifiche alla parte del codice indicato sulle istruzioni tuttavia non ci sono riuscito.
//app.js, is there a specific place to put this?
var ghost = require('ghost');
ghost().then(function (ghostServer) {
ghostServer.start();
});
//config.js
development: {
url: 'http://localhost:3000/blog',
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghostdev.db')
},
debug: false
},
server: {
host: '127.0.0.1',
port: '2368'
},
paths: {
contentPath: path.join(__dirname, '/content/'),
}
},
//index.js
ghost().then(function (ghostServer) {
parentApp.use(ghostServer.config.paths.subdir,ghostServer.rootApp);
// Let ghost handle starting our server instance.
ghostServer.start(parentApp);
}).catch(function (err) {
errors.logErrorAndExit(err, err.context, err.help);
});
EDIT: sono stato in grado di instradare il traffico con http-proxy tuttavia è trasferirlo al localhost: 2368/blog (che non esiste) tutte le idee su come prevenire questo?
var httpProxy = require('http-proxy');
var blogProxy = httpProxy.createProxyServer();
var ghost = require('ghost');
var path = require('path');
// Route /blog* to Ghost
router.get("/blog*", function(req, res, next){
blogProxy.ws(req, res, { target: 'http://localhost:2368' });
});