diff --git a/ConfigSys.js b/ConfigSys.js index dcb89c0..1d9a922 100644 --- a/ConfigSys.js +++ b/ConfigSys.js @@ -1,5 +1,5 @@ module.exports={ - protocol:'httpall', + protocol:'http', host:'localhost', port:undefined, // 如果使用 https 协议,必须填写以下内容,或在命令行参数中设置: diff --git a/server.js b/server.js index 8025a6e..f93cd05 100644 --- a/server.js +++ b/server.js @@ -28,7 +28,7 @@ try { // 载入命令行参数 commander .version(Config.VERSION, '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version' - .option('-h, --host ', 'host ip or domain name') + .option('-H, --host ', 'host ip or domain name') .option('-P, --protocol ', 'Web server protocol http|https|httpall, default to httpall') .option('-p, --port ', 'Server port, default to 80|443') .option('--sslCert ', 'SSL cert file') @@ -37,8 +37,8 @@ try { .parse(process.argv) // 把命令行参数 合并入配置。 - Config.host=commander.host || Config.host || 'localhost' - Config.protocol=commander.protocol || Config.protocol || 'httpall' // 默认同时启用 http 和 https + Config.host=commander.host || Config.host + Config.protocol=commander.protocol || Config.protocol // 默认同时启用 http 和 https Config.port=parseInt(commander.port) || parseInt(Config.port) || (Config.protocol==='http'?80:Config.protocol==='https'?443:undefined) // 端口默认为 http:80, https:443, httpall: 80|443 Config.sslCert=commander.sslCert || Config.sslCert Config.sslKey=commander.sslKey || Config.sslKey @@ -76,16 +76,12 @@ async function init(){ /*** 设置全局对象 ***/ server.use(compression()) /*** 路由 ***/ - //server.use(express.static(path.join(__dirname,'dist'), {index:'index.html'})) + server.use(express.static(path.join(__dirname,'dist'), {index:'index.html'})) - var webroot=express.static(path.join(__dirname,'dist'), {index:'index.html'}) - server.use(webroot) - - // var vhost = require('vhost') +// var vhost = require('vhost') +// var webroot=express.static(path.join(__dirname,'dist'), {index:'index.html'}) // server.use(vhost('bittic.org', webroot)) // server.use(vhost('www.bittic.org', webroot)) - // server.use(vhost('box.bittic.org', express.static(path.join(__dirname,'../ticbox/dist'), {index:'index.html'}))) - // server.use(vhost('wallet.bittic.org', express.static(path.join(__dirname,'../ticwalletx/dist'), {index:'index.html'}))) // server.use(vhost('*', webroot)) // server.use(vhost('*.*', webroot)) // server.use(vhost('*.*.*', webroot))