Ich versuche, Ghost auf ein Unterverzeichnis meiner Haupt-Node.js-Projekt auszuführen. Es ist derzeit in azurblauen Websites gehostet.
Etwas wie: http://randomurlforpost.azurewebsites.net/blogFühren Ghost in einem Unterverzeichnis meiner Haupt-Node.js-Anwendung
ich die Anleitung hier gefolgt: https://github.com/TryGhost/Ghost/wiki/Using-Ghost-as-an-NPM-module
Mit dem neuen Zusatz von Ghost als npm Modul brauche ich Nginx oder Apache noch ?. Ab sofort habe ich meine Hauptseite auf localhost: 3000 und die Ghost-Instanz läuft auf localhost: 2368.
Ich habe versucht, alle Arten von Änderungen an dem Teil des Codes, der auf den Anweisungen angegeben, aber ich habe es nicht gelungen.
//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: Ich war in der Lage zu routen Verkehr mit http-Proxy aber es wird das Routing auf localhost: 2368/Blog (was nicht existiert) alle Ideen auf, Wie kann man das verhindern?
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' });
});