Correction HAProxy

This commit is contained in:
nyanloutre 2018-04-03 21:58:01 +02:00
parent b8379b3ff9
commit 64ec245cf6
1 changed files with 12 additions and 13 deletions

View File

@ -3,41 +3,40 @@
{ {
services.haproxy.enable = true; services.haproxy.enable = true;
services.haproxy.config = '' services.haproxy.config = ''
defaults global
log /dev/log local0 log /dev/log local0
log /dev/log local1 notice log /dev/log local1 notice
chroot /var/lib/haproxy chroot /var/lib/haproxy
user haproxy user haproxy
group haproxy group haproxy
defaults
option forwardfor option forwardfor
option http-server-close option http-server-close
frontend www-http frontend www-http
bind tars.nyanlout.re:80 mode http
reqadd X-Forwarded-Proto:\ http bind :80
default_backend www-backend
frontend www-https
bind tars.nyanlout.re:443 ssl crt /var/lib/acme/tars.nyanlout.re/fullchain.pem
reqadd X-Forwarded-Proto:\ https
acl letsencrypt-acl path_beg /.well-known/acme-challenge/ acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl use_backend letsencrypt-backend if letsencrypt-acl
default_backend www-backend use_backend grafana-backend if !letsencrypt-acl
backend www-backend backend grafana-backend
redirect scheme https if !{ ssl_fc } mode http
server www-1 127.0.0.1:3000 check server grafana 127.0.0.1:3000 check
backend letsencrypt-backend backend letsencrypt-backend
mode http
server letsencrypt 127.0.0.1:54321 server letsencrypt 127.0.0.1:54321
''; '';
services.nginx.enable = true; services.nginx.enable = true;
services.nginx.virtualHosts = { services.nginx.virtualHosts = {
"acme" = { "acme" = {
listen = [ { port = 54321; } ]; listen = [ { addr = "127.0.0.1"; port = 54321; } ];
locations = { "/" = { root = "/var/www/challenges" }; }; locations = { "/" = { root = "/var/www/challenges"; }; };
}; };
}; };
security.acme.certs = { security.acme.certs = {
"tars.nyanlout.re" = { "tars.nyanlout.re" = {
user = "nginx";
webroot = "/var/www/challenges"; webroot = "/var/www/challenges";
email = "paul@nyanlout.re"; email = "paul@nyanlout.re";
}; };