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