|
|
@ -8,6 +8,7 @@ const conf = require('../utils/nginxConf'); |
|
|
|
const nginxReload = require('../utils/nginxReload'); |
|
|
|
const { appendToList } = require('../utils/listFile'); |
|
|
|
|
|
|
|
// Are EOL's neccessary since template literals handle new lines? PS: Unused import
|
|
|
|
const { EOL } = require('os'); // \n if used on Linux, \r\n if used on Windows.
|
|
|
|
|
|
|
|
function createStaticServer(domain, path, outPort) { |
|
|
@ -18,17 +19,17 @@ function createStaticServer(domain, path, outPort) { |
|
|
|
|
|
|
|
fs.outputFileSync((conf(npath.enabledSites(), domain, outPort)), |
|
|
|
// Gets nginx's paths from nginxPath.js
|
|
|
|
"server {" + EOL + |
|
|
|
" listen " + outPort + ";" + EOL + |
|
|
|
" listen [::]:" + outPort + ";" + EOL + |
|
|
|
" root " + npath.webRoot() + domain + "." + outPort + ";" + EOL + |
|
|
|
" index index.html index.htm;" + EOL + |
|
|
|
"" + EOL + |
|
|
|
" server_name " + domain + ";" + EOL + |
|
|
|
" location / {" + EOL + |
|
|
|
" try_files $uri $uri/ =404;" + EOL + |
|
|
|
" }" + EOL + |
|
|
|
"}" |
|
|
|
`server {
|
|
|
|
listen ${outPort}; |
|
|
|
listen [::]:" ${outPort}; |
|
|
|
root ${npath.webRoot()}${domain}.${outPort}; |
|
|
|
index index.html index.htm; |
|
|
|
|
|
|
|
server_name ${domain}; |
|
|
|
location / { |
|
|
|
try_files $uri $uri/ =404; |
|
|
|
} |
|
|
|
}` |
|
|
|
); |
|
|
|
|
|
|
|
shell.rm('-rf', npath.webRootDomain(domain, outPort)); |
|
|
|