修正:vhost相关代码片段里用到了 express,需要提前单独定义。
This commit is contained in:
parent
4169015794
commit
8f9794afbf
@ -69,7 +69,8 @@ async function init(){ /*** 设置全局对象 ***/
|
||||
(async function start(){
|
||||
await init()
|
||||
|
||||
const server = require('express')()
|
||||
const express=require('express')
|
||||
const server = express()
|
||||
|
||||
const greenlock = (wo.Config.sslType === 'greenlock') ? require('greenlock-express').create({
|
||||
version: 'draft-11',
|
||||
@ -95,7 +96,7 @@ async function init(){ /*** 设置全局对象 ***/
|
||||
// express.static 找到了具体文件,就返回;找不到,就next()
|
||||
// 所以,如果 vhost匹配了域名,且static找到了文件,就结束了。如果 vhost 匹配了域名,但static找不到文件,就继续往下。
|
||||
if (!wo.Config.vhosts) {
|
||||
server.use(require('express').static(path.join(process.cwd(), wo.Config.from), {index: 'index.html'}))
|
||||
server.use(express.static(path.join(process.cwd(), wo.Config.from), {index: 'index.html'}))
|
||||
// server.use(require('serve-favicon')(path.join(process.cwd(), 'public', 'favicon.ico'))) // uncomment after placing your favicon in /public
|
||||
}else {
|
||||
let vhost = require('vhost')
|
||||
|
Loading…
Reference in New Issue
Block a user