默认只启动 http server,不要 https server。
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
module.exports={
|
module.exports={
|
||||||
protocol:'httpall',
|
protocol:'http',
|
||||||
host:'localhost',
|
host:'localhost',
|
||||||
port:undefined,
|
port:undefined,
|
||||||
// 如果使用 https 协议,必须填写以下内容,或在命令行参数中设置:
|
// 如果使用 https 协议,必须填写以下内容,或在命令行参数中设置:
|
||||||
|
|||||||
14
server.js
14
server.js
@@ -28,7 +28,7 @@ try {
|
|||||||
// 载入命令行参数
|
// 载入命令行参数
|
||||||
commander
|
commander
|
||||||
.version(Config.VERSION, '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version'
|
.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, --protocol <protocol>', 'Web server protocol http|https|httpall, default to httpall')
|
||||||
.option('-p, --port <port>', 'Server port, default to 80|443')
|
.option('-p, --port <port>', 'Server port, default to 80|443')
|
||||||
.option('--sslCert <cert>', 'SSL cert file')
|
.option('--sslCert <cert>', 'SSL cert file')
|
||||||
@@ -37,8 +37,8 @@ try {
|
|||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
// 把命令行参数 合并入配置。
|
// 把命令行参数 合并入配置。
|
||||||
Config.host=commander.host || Config.host || 'localhost'
|
Config.host=commander.host || Config.host
|
||||||
Config.protocol=commander.protocol || Config.protocol || 'httpall' // 默认同时启用 http 和 https
|
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.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.sslCert=commander.sslCert || Config.sslCert
|
||||||
Config.sslKey=commander.sslKey || Config.sslKey
|
Config.sslKey=commander.sslKey || Config.sslKey
|
||||||
@@ -76,16 +76,12 @@ async function init(){ /*** 设置全局对象 ***/
|
|||||||
server.use(compression())
|
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('bittic.org', webroot))
|
||||||
// server.use(vhost('www.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))
|
// server.use(vhost('*.*', webroot))
|
||||||
// server.use(vhost('*.*.*', webroot))
|
// server.use(vhost('*.*.*', webroot))
|
||||||
|
|||||||
Reference in New Issue
Block a user