bug fix: 作为库使用时,不能 __dirname 作为根目录起点,要用 process.cwd()
This commit is contained in:
parent
2d1dbe8eee
commit
9b2e72c19a
@ -60,17 +60,17 @@ if (typeof wo.envi.ssl === 'string') {
|
||||
// 所以,如果 vhost匹配了域名,且static找到了文件,就结束了。如果 vhost 匹配了域名,但static找不到文件,就继续往下。
|
||||
if (!wo.envi.vhosts) {
|
||||
server.use(
|
||||
express.static(path.join(__dirname, wo.envi.webroot).replace('\\', '/'), { index: wo.envi.webindex }) // 可以指定到 node应用之外的目录上。windows里要把 \ 换成 /。
|
||||
express.static(path.join(process.cwd(), wo.envi.webroot).replace('\\', '/'), { index: wo.envi.webindex }) // 可以指定到 node应用之外的目录上。windows里要把 \ 换成 /。
|
||||
)
|
||||
// server.use(require('serve-favicon')(path.join(process.cwd(), 'public', 'favicon.ico'))) // uncomment after placing your favicon in /public
|
||||
} else {
|
||||
//server.use(require('serve-favicon')(path.join(process.cwd(), wo.envi.webroot, 'favicon.ico')))
|
||||
} else {
|
||||
let vhost = require('vhost')
|
||||
for (let h of wo.envi.vhosts) {
|
||||
for (let domain of h.domainList) {
|
||||
server.use(
|
||||
vhost(
|
||||
domain,
|
||||
express.static(path.join(__dirname, h.webroot).replace('\\', '/'), { index: h.webindex }) // 可以指定到 node应用之外的目录上。windows里要把 \ 换成 /。
|
||||
express.static(path.join(process.cwd(), h.webroot).replace('\\', '/'), { index: h.webindex }) // 可以指定到 node应用之外的目录上。windows里要把 \ 换成 /。
|
||||
)
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user