Sha256: a7202f90a2b0ef3f119921d723ae02b6191b39a6b676dfc756f3483e9388456c

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

<%- upstreams.each do |upstream| %>

upstream <%= upstream[:name] %> {
  server <%= upstream[:name] %>:<%= upstream[:port] %>;
}
<%- upstream[:domains].partition{|domain| domain.include?("http://")}.reject(&:empty?).each do |domains| %>
<%-
  https = domains.first.include?("https://")
  domains = domains.collect{|domain| domain.gsub(/https?:\/\//, "")}.join(" ")
  domain = domains.split(" ")[0]
  proxy_pass = "http://#{ upstream[:name] }"
%>

server {
  listen 80;
  server_name <%= domains %>;
  server_tokens off;

  <%- if https %>
  location /.well-known/acme-challenge/ {
    root /var/www/certbot;
  }

  location / {
    return 301 https://$host$request_uri;
  }
}

server {
  listen 443 ssl;
  server_name <%= domains %>;
  server_tokens off;

  ssl_certificate /etc/letsencrypt/live/<%= domain %>/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/<%= domain %>/privkey.pem;
  include /etc/letsencrypt/options-ssl-nginx.conf;
  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

  <%- end %>
  <%- if upstream[:nginx] %>
<%= upstream[:nginx].gsub("PROXY_PASS", proxy_pass).indent(2) %>

  <%- end %>
  location / {
    proxy_pass        <%= proxy_pass %>;
    proxy_set_header  Host $http_host;
    proxy_set_header  X-Real-IP $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}
<%- end %>
<%- end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vps-0.1.1 templates/docker/data/nginx/app.conf.erb