openshift nodeJS应用程序 – git最新/服务器运行没有错误,但我仍然看到欢迎页面
我正尝试在OpenShift上托pipe一个使用socket.io的nodeJS应用程序。 我在openshift上创build了应用程序,使用git clone
来获取回购 – 然后我编辑server.js
,如下所示:
#!/bin/env node var express = require('express'); var app = express() , server = require('http').createServer(app) , io = require('socket.io').listen(server); var osipaddress = process.env.OPENSHIFT_NODEJS_IP; var osport = process.env.OPENSHIFT_NODEJS_PORT; app.set('port', osport || 8000); app.set('ipaddress', osipaddress); /*var pf = require('policyfile').createServer(); pf.listen(10843, function(){ console.log(':3 yay') });*/ server.listen(app.get('port'), app.get('ipaddress'), function(){ console.log('Express server listening on port ' + app.get('port')); }); app.use(express.static(__dirname + '/')); app.get('/', function (req, res) { res.sendfile(__dirname + '/Startup.html'); }); io.configure(function() { io.set('transports', ['websocket','xhr-polling']); io.set('flash policy port', 10843); //io.set('log level', 1); }); io.sockets.on('connection', function (socket) { socket.on('message', function (data) { console.log(data); }); });
然后我使用git commit
/ git push
来进行更改。
当我运行rhc tail testapp
,输出不会产生任何错误:
/Users/Eamon/.rvm/gems/ruby-2.0.0-p0/gems/highline-1.6.21/lib/highline/system_extensions.rb:230: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 DEBUG: Running node-supervisor with DEBUG: program 'server.js' DEBUG: --watch '/var/lib/openshift/53a2e6275973ca689c000060/app-root/data/.nodewatch' DEBUG: --ignore 'undefined' DEBUG: --extensions 'node|js|coffee' DEBUG: --exec 'node' DEBUG: Starting child process with 'node server.js' DEBUG: Watching directory '/var/lib/openshift/53a2e6275973ca689c000060/app-root/data/.nodewatch' for changes. info: socket.io started Express server listening on port 8080
但是,当我访问该网站 – 我仍然看到最初的欢迎页面(就像我没有推任何代码) – http://testapp-eamonbenproject.rhcloud.com/
有任何想法吗? 由于我没有真正得到错误,我不知道从哪里开始。
Startup.html
需要命名为index.html
openshift才能正常工作。