Skip to content

Commit

Permalink
fix: ensure that server names are unique
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Oct 22, 2020
1 parent 7eb7bc4 commit b2f7cef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

console.log("is production:", PRODUCTION);

const normalizePortSuffix = port => (String(port) === "443" || String(port) === "80" ? "" : `:${port}`);

const generatePackageJson = () =>
JSON.stringify(
{
Expand Down Expand Up @@ -65,7 +67,7 @@ server {
ssl_certificate /etc/letsencrypt/live/${domainName}/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/${domainName}/privkey.pem; # managed by Certbot
server_name ${domainName} www.${domainName};
server_name ${domainName}${normalizePortSuffix(publicPort)} www.${domainName}${normalizePortSuffix(publicPort)};
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
Expand Down

0 comments on commit b2f7cef

Please sign in to comment.