diff --git a/src/nginxconfig/generators/conf/website.conf.js b/src/nginxconfig/generators/conf/website.conf.js index f236cc3..419c177 100644 --- a/src/nginxconfig/generators/conf/website.conf.js +++ b/src/nginxconfig/generators/conf/website.conf.js @@ -56,12 +56,12 @@ const sslConfig = (domain, global) => { return config; }; -const httpsListen = domain => { +const httpsListen = (domain, global) => { const config = []; // HTTPS config.push(['listen', - `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 ssl${domain.https.http2.computed ? ' http2' : ''}${domain.https.portReuse.computed ? ' reuseport' : ''}`]); + `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 ssl${domain.https.http2.computed ? ' http2' : ''}${global.https.portReuse.computed ? ' reuseport' : ''}`]); // HTTP/3 if (domain.https.http3.computed) @@ -71,7 +71,7 @@ const httpsListen = domain => { // v6 if (domain.server.listenIpv6.computed) config.push(['listen', - `[${domain.server.listenIpv6.computed}]:443 ssl${domain.https.http2.computed ? ' http2' : ''}${domain.https.portReuse.computed ? ' reuseport' : ''}`]); + `[${domain.server.listenIpv6.computed}]:443 ssl${domain.https.http2.computed ? ' http2' : ''}${global.https.portReuse.computed ? ' reuseport' : ''}`]); // v6 HTTP/3 if (domain.server.listenIpv6.computed && domain.https.http3.computed) @@ -95,8 +95,8 @@ const httpListen = domain => { return config; }; -const listenConfig = domain => { - if (domain.https.https.computed) return httpsListen(domain); +const listenConfig = (domain, global) => { + if (domain.https.https.computed) return httpsListen(domain, global); return httpListen(domain); }; @@ -141,7 +141,7 @@ export default (domain, domains, global) => { if (!domain.https.https.computed || !domain.https.forceHttps.computed) serverConfig.push(...httpListen(domain)); // HTTPS - if (domain.https.https.computed) serverConfig.push(...httpsListen(domain)); + if (domain.https.https.computed) serverConfig.push(...httpsListen(domain, global)); serverConfig.push(['server_name', `${domain.server.wwwSubdomain.computed ? 'www.' : ''}${domain.server.domain.computed}`]); @@ -340,7 +340,7 @@ export default (domain, domains, global) => { // Build the server config on its own before adding it to the parent config const cdnConfig = []; - cdnConfig.push(...listenConfig(domain)); + cdnConfig.push(...listenConfig(domain, global)); cdnConfig.push(['server_name', `cdn.${domain.server.domain.computed}`]); cdnConfig.push(['root', `${domain.server.path.computed}${domain.server.documentRoot.computed}`]); @@ -383,7 +383,7 @@ export default (domain, domains, global) => { // Build the server config on its own before adding it to the parent config const redirectConfig = []; - redirectConfig.push(...listenConfig(domain)); + redirectConfig.push(...listenConfig(domain, global)); redirectConfig.push(['server_name', `${domain.server.wwwSubdomain.computed ? '' : '*'}.${domain.server.domain.computed}`]); diff --git a/src/nginxconfig/i18n/en/templates/domain_sections/https.js b/src/nginxconfig/i18n/en/templates/domain_sections/https.js index 9aefe26..a6511b6 100644 --- a/src/nginxconfig/i18n/en/templates/domain_sections/https.js +++ b/src/nginxconfig/i18n/en/templates/domain_sections/https.js @@ -32,8 +32,6 @@ export default { enableHttp2Connections: `${common.enable} ${common.http}/2 connections`, http3: `${common.http}/3`, enableHttp3Connections: `${common.enable} ${common.http}/3 connections`, - portReuse: 'Reuseport', - enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, forceHttps: `Force ${common.https}`, hsts: 'HSTS', enableStrictTransportSecurity: `${common.enable} Strict Transport Security, requiring HTTPS connections`, diff --git a/src/nginxconfig/i18n/en/templates/global_sections/https.js b/src/nginxconfig/i18n/en/templates/global_sections/https.js index ddef688..7393aa6 100644 --- a/src/nginxconfig/i18n/en/templates/global_sections/https.js +++ b/src/nginxconfig/i18n/en/templates/global_sections/https.js @@ -33,6 +33,8 @@ const ipv6 = 'IPv6'; export default { sslProfile: `${common.ssl} Profile`, httpsMustBeEnabledOnOneSite: `${common.https} must be enabled on at least one site to configure global ${common.https} settings.`, + portReuse: 'Reuseport', + enableReuseOfPort: `${common.enable} reuseport to generate a listening socket per worker`, ocspDnsResolvers: 'OCSP DNS Resolvers', cloudflareResolver: 'Cloudflare Resolver', googlePublicDns: 'Google Public DNS', diff --git a/src/nginxconfig/templates/domain_sections/https.vue b/src/nginxconfig/templates/domain_sections/https.vue index 52a205f..1e13240 100644 --- a/src/nginxconfig/templates/domain_sections/https.vue +++ b/src/nginxconfig/templates/domain_sections/https.vue @@ -96,24 +96,6 @@ THE SOFTWARE. -