scripts/nginx_config_maker/model.symfony.mjs

40 lines
1.3 KiB
JavaScript

/**
* turns a domain config to two config files for nginx web sever on proxmox and its container
* @param domainConfig
* @returns {{homeNginxConf: string, containerNginxConf: string}}
*/
export function makeHostFileForSymfony(domainConfig){
const model = {
homeNginxConf : `
# ---------------- ${domainConfig.name} -------------------------
server {
server_name ${domainConfig.name};
listen 80 http2;
return 301 https://${domainConfig.name}$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ${domainConfig.name};
${domainConfig.disableSSL ? '#' : ''} ssl_certificate /etc/letsencrypt/live/${domainConfig.name}-0001/fullchain.pem;
${domainConfig.disableSSL ? '#' : ''} ssl_certificate_key /etc/letsencrypt/live/${domainConfig.name}-0001/privkey.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
# redirection to containter
proxy_pass http://${domainConfig.LXCcontainerLocalIP};
}
add_header Permissions-Policy "interest-cohort=()";
}
`,
containerNginxConf : ``
}
return model;
}