修正 SSL 憑證拼接換行問題
This commit is contained in:
@@ -36,10 +36,28 @@ build_cert_bundle() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat "${cert_path}" "${chain_path}" > "${GENERATED_CERT_PATH}"
|
||||
normalize_pem_file "${cert_path}" > "${GENERATED_CERT_PATH}"
|
||||
normalize_pem_file "${chain_path}" >> "${GENERATED_CERT_PATH}"
|
||||
cp "${key_path}" "${GENERATED_KEY_PATH}"
|
||||
}
|
||||
|
||||
normalize_pem_file() {
|
||||
pem_path="$1"
|
||||
|
||||
awk '
|
||||
{
|
||||
sub(/\r$/, "")
|
||||
print
|
||||
has_content = 1
|
||||
}
|
||||
END {
|
||||
if (has_content) {
|
||||
print ""
|
||||
}
|
||||
}
|
||||
' "${pem_path}"
|
||||
}
|
||||
|
||||
write_nginx_config() {
|
||||
cat > /etc/nginx/conf.d/default.conf <<EOF
|
||||
server {
|
||||
|
||||
Reference in New Issue
Block a user