Assorted cleanup + fixes (#249)

* Move i18n strings to correct files

* Update copyright header in recently modified files

* More consistent line wrapping

* Move modules above events block
pull/250/head
Matt (IPv4) Cowley 2021-03-31 14:12:50 +01:00 committed by GitHub
parent 34ec037d13
commit 7a0b6937c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 58 additions and 51 deletions

View File

@ -42,15 +42,17 @@ export default (domains, global) => {
config.pid = global.nginx.pid.computed;
config.worker_processes = global.nginx.workerProcesses.computed;
config.worker_rlimit_nofile = 65535;
// Modules
config['# Load modules'] = '';
config.include = `${global.nginx.nginxConfigDirectory.computed.replace(/\/+$/, '')}/modules-enabled/*.conf`;
// Events
config.events = {
multi_accept: 'on',
worker_connections: 65535,
};
// Modules!
config['# Load modules'] = '';
config.include = `${global.nginx.nginxConfigDirectory.computed.replace(/\/+$/, '')}/modules-enabled/*`;
// HTTP (kv so we can use the same key multiple times)
config.http = [];

View File

@ -60,14 +60,13 @@ const httpsListen = domain => {
const config = [];
// HTTPS
config.push(['listen', `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 ssl${domain.https.http2.computed ? ' http2' : ''}`]);
config.push(['listen',
`${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 ssl${domain.https.http2.computed ? ' http2' : ''}`]);
// HTTP/3
if (domain.https.http3.computed)
config.push(['listen',
`${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 http3`
+ `${domain.https.portReuse.computed ? ' reuseport' : ''}`,
]);
`${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`]);
// v6
if (domain.server.listenIpv6.computed)
@ -77,8 +76,8 @@ const httpsListen = domain => {
// v6 HTTP/3
if (domain.server.listenIpv6.computed && domain.https.http3.computed)
config.push(['listen',
`[${domain.server.listenIpv6.computed}]:443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`,
]);
`[${domain.server.listenIpv6.computed}]:443 http3${domain.https.portReuse.computed ? ' reuseport' : ''}`]);
return config;
};
@ -86,7 +85,8 @@ const httpListen = domain => {
const config = [];
// Not HTTPS
config.push(['listen', `${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`]);
config.push(['listen',
`${domain.server.listenIpv4.computed === '*' ? '' : `${domain.server.listenIpv4.computed}:`}80`]);
// v6
if (domain.server.listenIpv6.computed)
@ -204,7 +204,8 @@ export default (domain, domains, global) => {
serverConfig.push(['# logging', '']);
if (domain.logging.accessLog.computed)
serverConfig.push(['access_log', getAccessLogDomainPath(domain, global) + (global.logging.cloudflare.computed ? ' cloudflare' : '')]);
serverConfig.push(['access_log',
getAccessLogDomainPath(domain, global) + (global.logging.cloudflare.computed ? ' cloudflare' : '')]);
if (domain.logging.errorLog.computed)
serverConfig.push(['error_log', getErrorLogDomainPath(domain, global)]);
@ -383,12 +384,14 @@ export default (domain, domains, global) => {
const redirectConfig = [];
redirectConfig.push(...listenConfig(domain));
redirectConfig.push(['server_name', `${domain.server.wwwSubdomain.computed ? '' : '*'}.${domain.server.domain.computed}`]);
redirectConfig.push(['server_name',
`${domain.server.wwwSubdomain.computed ? '' : '*'}.${domain.server.domain.computed}`]);
// HTTPS
redirectConfig.push(...sslConfig(domain, global));
redirectConfig.push(['return', `301 http${domain.https.https.computed ? 's' : ''}://${domain.server.wwwSubdomain.computed ? 'www.' : ''}${domain.server.domain.computed}$request_uri`]);
redirectConfig.push(['return',
`301 http${domain.https.https.computed ? 's' : ''}://${domain.server.wwwSubdomain.computed ? 'www.' : ''}${domain.server.domain.computed}$request_uri`]);
// Add the redirect config to the parent config now its built
config.push([`# ${domain.server.wwwSubdomain.computed ? 'non-www, ' : ''}subdomains redirect`, '']);
@ -400,7 +403,8 @@ export default (domain, domains, global) => {
// Add the redirect config to the parent config now its built
config.push(['# HTTP redirect', '']);
if (domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) {
config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed, `www.${domain.server.domain.computed}`)]);
config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed,
`www.${domain.server.domain.computed}`)]);
config.push(['server', httpRedirectConfig(domain, global, `www.${domain.server.domain.computed}`)]);
} else if (!domain.server.wwwSubdomain.computed && !domain.server.redirectSubdomains.computed) {
config.push(['server', httpRedirectConfig(domain, global, domain.server.domain.computed)]);
@ -409,7 +413,8 @@ export default (domain, domains, global) => {
config.push(['server', httpRedirectConfig(domain, global, `cdn.${domain.server.domain.computed}`)]);
}
if (domain.server.redirectSubdomains.computed) {
config.push(['server', httpRedirectConfig(domain, global, `.${domain.server.domain.computed}`, `${domain.server.wwwSubdomain.computed ? 'www.' : '' }${domain.server.domain.computed}`)]);
config.push(['server', httpRedirectConfig(domain, global, `.${domain.server.domain.computed}`,
`${domain.server.wwwSubdomain.computed ? 'www.' : '' }${domain.server.domain.computed}`)]);
}
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2021 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -42,4 +42,9 @@ export default {
certificationType: 'Certification type',
customCertificate: 'Custom certificate',
letsEncryptEmail: `${common.letsEncrypt} email`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ',
http3Warning2: 'NGINX QUIC readme ',
http3Warning3: ' or the ',
http3Warning4: 'Cloudflare quiche project ',
http3Warning5: ' for how to build NGINX with HTTP/3!',
};

View File

@ -47,9 +47,4 @@ export default {
ipv4Only: `${ipv4} only`,
ipv6Only: `${ipv6} only`,
ipv4AndIpv6: `${ipv4} & ${ipv6}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ',
http3Warning2: 'NGINX QUIC readme ',
http3Warning3: ' or the ',
http3Warning4: 'Cloudflare quiche project ',
http3Warning5: ' for how to build NGINX with HTTP/3!',
};

View File

@ -42,4 +42,9 @@ export default {
certificationType: 'Type de certification',
customCertificate: 'Certificat personnalisé',
letsEncryptEmail: `E-mail ${common.letsEncrypt}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -47,9 +47,4 @@ export default {
ipv4Only: `${ipv4} seulement`,
ipv6Only: `${ipv6} seulement`,
ipv4AndIpv6: `${ipv4} & ${ipv6}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2021 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -42,4 +42,9 @@ export default {
certificationType: 'Tipo de certificação',
customCertificate: 'Certificado personalizado',
letsEncryptEmail: `E-mail do ${common.letsEncrypt}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -47,9 +47,4 @@ export default {
ipv4Only: `${ipv4} apenas`,
ipv6Only: `${ipv6} apenas`,
ipv4AndIpv6: `${ipv4} & ${ipv6}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -42,4 +42,9 @@ export default {
certificationType: 'Тип сертификации',
customCertificate: 'Другой сертификат',
letsEncryptEmail: `${common.letsEncrypt} email`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -47,9 +47,4 @@ export default {
ipv4Only: `только ${ipv4}`,
ipv6Only: `только ${ipv6}`,
ipv4AndIpv6: `${ipv4} & ${ipv6}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2021 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -42,4 +42,9 @@ export default {
certificationType: '证书类型',
customCertificate: '本地证书',
letsEncryptEmail: `${common.letsEncrypt} 邮箱`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -47,9 +47,4 @@ export default {
ipv4Only: `${ipv4}`,
ipv6Only: `${ipv6}`,
ipv4AndIpv6: `${ipv4} & ${ipv6}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2021 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -42,4 +42,9 @@ export default {
certificationType: '證書類型',
customCertificate: '本地證書',
letsEncryptEmail: `${common.letsEncrypt} 郵箱`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -47,9 +47,4 @@ export default {
ipv4Only: `${ipv4}`,
ipv6Only: `${ipv6}`,
ipv4AndIpv6: `${ipv4} & ${ipv6}`,
http3Warning1: 'HTTP/3 isn\'t a standard NGINX module, check the ', // TODO: translate
http3Warning2: 'NGINX QUIC readme ', // TODO: translate
http3Warning3: ' or the ', // TODO: translate
http3Warning4: 'Cloudflare quiche project ', // TODO: translate
http3Warning5: ' for how to build NGINX with HTTP/3!', // TODO: translate
};

View File

@ -1,5 +1,5 @@
<!--
Copyright 2020 DigitalOcean
Copyright 2021 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at