node.js Webサーバー(ubunt)にこのスクリプトを使用しています:
var util = require('util'),
http = require('http'),
fs = require('fs');
fs.readFile('htdocs/index.html', function (err, html) {
if (err) {
throw err;
}
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(html);
response.end();
}).listen(80);
util.puts('> Server is running');
});
私はスクリプトを次のように開始しています:
forever start server.js
...そしてそれは機能します。
しかし、index.html のような単純な html ファイルを test.html へのリンクとともにアップロードすると、うまくいきません。
スクリプトを停止して開始した場合にのみ機能します。しかし、index.html から test.html へのリンクは機能しません。