默认只启动 http server,不要 https server。
This commit is contained in:
16
server.js
16
server.js
@@ -28,7 +28,7 @@ try {
|
||||
// 载入命令行参数
|
||||
commander
|
||||
.version(Config.VERSION, '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version'
|
||||
.option('-h, --host <host>', 'host ip or domain name')
|
||||
.option('-H, --host <host>', 'host ip or domain name')
|
||||
.option('-P, --protocol <protocol>', 'Web server protocol http|https|httpall, default to httpall')
|
||||
.option('-p, --port <port>', 'Server port, default to 80|443')
|
||||
.option('--sslCert <cert>', '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))
|
||||
|
||||
Reference in New Issue
Block a user