From 9b2e72c19a1b0b884670041ae410901fe3911e16 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sun, 24 Oct 2021 08:45:13 +0800 Subject: [PATCH] =?UTF-8?q?bug=20fix:=20=E4=BD=9C=E4=B8=BA=E5=BA=93?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=97=B6=EF=BC=8C=E4=B8=8D=E8=83=BD=20=5F=5F?= =?UTF-8?q?dirname=20=E4=BD=9C=E4=B8=BA=E6=A0=B9=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E8=B5=B7=E7=82=B9=EF=BC=8C=E8=A6=81=E7=94=A8=20process.cwd()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index 2e28017..9f0e0f1 100644 --- a/server.js +++ b/server.js @@ -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里要把 \ 换成 /。 ) ) }