【发布时间】:2015-03-08 23:50:20
【问题描述】:
我已经对我的节点应用程序进行了一些更新,部署到 OpenShift,现在它在运行时不会发送 index.html 文件。我也更新了 Express 并修复了那里的所有错误......
我的目录结构如下:
/Site/
....server.js
....app/
........index.html/
我的服务器如下所示:
var express = require('express');
var app = express();
var path = require('path');
app.use(express.static('app'));
require('./server-stripe.js')(app);
app.get('*', function(req, res) {
res.sendFile(path.resolve(__dirname + 'app/index.html'));
});
var server_port = process.env.OPENSHIFT_NODEJS_PORT || 8080
var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || process.env.OPENSHIFT_INTERNAL_IP ||'127.0.0.1'
app.listen(server_port, server_ip_address, function () {
console.log( "Listening on " + server_ip_address + ", server_port " + server_port )
});
它在我的本地环境中运行良好,但在生产中我得到 503 Service Unavailable。
任何建议将不胜感激! Whits结束了;)
谢谢, 马特
编辑 这是日志:
==> app-root/logs/haproxy.log <==
[WARNING] 009/181452 (443835) : Server express/local-gear is UP (leaving maintenance).
[WARNING] 009/181453 (443835) : Server express/local-gear is DOWN, reason: Layer7 wrong status, code: 404, info: "Not Found", check duration: 36ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 009/181453 (443835) : proxy 'express' has no server available!
==> app-root/logs/nodejs.log <==
Error: ENOENT, stat '/var/lib/openshift/539976e05004467473000668/app-root/runtime/repo/app/index.html'
我正在阅读 hapoxy 的东西,虽然我不太了解它?
【问题讨论】:
-
你看过日志了吗?
标签: node.js express openshift server