Only make nginx listen on ipv6 connections if it is supported by the system
Could not decide on the ejs formatting, never nice for me
This commit is contained in:
@@ -34,11 +34,11 @@ if [[ "${arg_retire_reason}" != "" || "${existing_infra}" != "${current_infra}"
|
|||||||
echo "Showing progress bar on all subdomains in retired mode or infra update. retire: ${arg_retire_reason} existing: ${existing_infra} current: ${current_infra}"
|
echo "Showing progress bar on all subdomains in retired mode or infra update. retire: ${arg_retire_reason} existing: ${existing_infra} current: ${current_infra}"
|
||||||
rm -f ${PLATFORM_DATA_DIR}/nginx/applications/*
|
rm -f ${PLATFORM_DATA_DIR}/nginx/applications/*
|
||||||
${box_src_dir}/node_modules/.bin/ejs-cli -f "${script_dir}/start/nginx/appconfig.ejs" \
|
${box_src_dir}/node_modules/.bin/ejs-cli -f "${script_dir}/start/nginx/appconfig.ejs" \
|
||||||
-O "{ \"vhost\": \"~^(.+)\$\", \"adminOrigin\": \"${admin_origin}\", \"endpoint\": \"splash\", \"sourceDir\": \"${SETUP_WEBSITE_DIR}\", \"certFilePath\": \"cert/host.cert\", \"keyFilePath\": \"cert/host.key\", \"xFrameOptions\": \"SAMEORIGIN\", \"robotsTxtQuoted\": null }" > "${PLATFORM_DATA_DIR}/nginx/applications/admin.conf"
|
-O "{ \"vhost\": \"~^(.+)\$\", \"adminOrigin\": \"${admin_origin}\", \"endpoint\": \"splash\", \"sourceDir\": \"${SETUP_WEBSITE_DIR}\", \"certFilePath\": \"cert/host.cert\", \"keyFilePath\": \"cert/host.key\", \"xFrameOptions\": \"SAMEORIGIN\", \"robotsTxtQuoted\": null, \"hasIPv6\": false }" > "${PLATFORM_DATA_DIR}/nginx/applications/admin.conf"
|
||||||
else
|
else
|
||||||
echo "Show progress bar only on admin domain for normal update"
|
echo "Show progress bar only on admin domain for normal update"
|
||||||
${box_src_dir}/node_modules/.bin/ejs-cli -f "${script_dir}/start/nginx/appconfig.ejs" \
|
${box_src_dir}/node_modules/.bin/ejs-cli -f "${script_dir}/start/nginx/appconfig.ejs" \
|
||||||
-O "{ \"vhost\": \"${admin_fqdn}\", \"adminOrigin\": \"${admin_origin}\", \"endpoint\": \"splash\", \"sourceDir\": \"${SETUP_WEBSITE_DIR}\", \"certFilePath\": \"cert/host.cert\", \"keyFilePath\": \"cert/host.key\", \"xFrameOptions\": \"SAMEORIGIN\", \"robotsTxtQuoted\": null }" > "${PLATFORM_DATA_DIR}/nginx/applications/admin.conf"
|
-O "{ \"vhost\": \"${admin_fqdn}\", \"adminOrigin\": \"${admin_origin}\", \"endpoint\": \"splash\", \"sourceDir\": \"${SETUP_WEBSITE_DIR}\", \"certFilePath\": \"cert/host.cert\", \"keyFilePath\": \"cert/host.key\", \"xFrameOptions\": \"SAMEORIGIN\", \"robotsTxtQuoted\": null, \"hasIPv6\": false }" > "${PLATFORM_DATA_DIR}/nginx/applications/admin.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${arg_retire_reason}" == "migrate" ]]; then
|
if [[ "${arg_retire_reason}" == "migrate" ]]; then
|
||||||
|
|||||||
@@ -5,14 +5,18 @@ map $http_upgrade $connection_upgrade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
<% if (vhost) { %>
|
<% if (vhost) { -%>
|
||||||
listen 443 http2;
|
|
||||||
listen [::]:443 http2;
|
|
||||||
server_name <%= vhost %>;
|
server_name <%= vhost %>;
|
||||||
<% } else { %>
|
listen 443 http2;
|
||||||
|
<% if (hasIPv6) { -%>
|
||||||
|
listen [::]:443 http2;
|
||||||
|
<% } -%>
|
||||||
|
<% } else { -%>
|
||||||
listen 443 http2 default_server;
|
listen 443 http2 default_server;
|
||||||
|
<% if (hasIPv6) { -%>
|
||||||
listen [::]:443 http2 default_server;
|
listen [::]:443 http2 default_server;
|
||||||
<% } %>
|
<% } -%>
|
||||||
|
<% } -%>
|
||||||
|
|
||||||
ssl on;
|
ssl on;
|
||||||
# paths are relative to prefix and not to this file
|
# paths are relative to prefix and not to this file
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ function configureAdmin(certFilePath, keyFilePath, configFileName, vhost, callba
|
|||||||
sourceDir: path.resolve(__dirname, '..'),
|
sourceDir: path.resolve(__dirname, '..'),
|
||||||
adminOrigin: config.adminOrigin(),
|
adminOrigin: config.adminOrigin(),
|
||||||
vhost: vhost, // if vhost is empty it will become the default_server
|
vhost: vhost, // if vhost is empty it will become the default_server
|
||||||
|
hasIPv6: config.hasIPv6(),
|
||||||
endpoint: 'admin',
|
endpoint: 'admin',
|
||||||
certFilePath: certFilePath,
|
certFilePath: certFilePath,
|
||||||
keyFilePath: keyFilePath,
|
keyFilePath: keyFilePath,
|
||||||
@@ -60,6 +61,7 @@ function configureApp(app, certFilePath, keyFilePath, callback) {
|
|||||||
sourceDir: sourceDir,
|
sourceDir: sourceDir,
|
||||||
adminOrigin: config.adminOrigin(),
|
adminOrigin: config.adminOrigin(),
|
||||||
vhost: vhost,
|
vhost: vhost,
|
||||||
|
hasIPv6: config.hasIPv6(),
|
||||||
port: app.httpPort,
|
port: app.httpPort,
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
certFilePath: certFilePath,
|
certFilePath: certFilePath,
|
||||||
|
|||||||
Reference in New Issue
Block a user