public-web-static: add configuration for www.didays.de redirect
This commit is contained in:
parent
c11128ea4d
commit
726dab1ccf
1 changed files with 40 additions and 0 deletions
|
|
@ -5,10 +5,15 @@ let
|
||||||
dataDir = "/var/www/${domain}";
|
dataDir = "/var/www/${domain}";
|
||||||
deployUser = "didays-deploy";
|
deployUser = "didays-deploy";
|
||||||
in {
|
in {
|
||||||
|
security.acme.certs."${domain}".extraDomainNames = [ "www.${domain}" ];
|
||||||
|
|
||||||
services.nginx.virtualHosts = {
|
services.nginx.virtualHosts = {
|
||||||
"acme-${domain}" = {
|
"acme-${domain}" = {
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
serverName = "${domain}";
|
serverName = "${domain}";
|
||||||
|
serverAliases = [
|
||||||
|
"www.${domain}"
|
||||||
|
];
|
||||||
|
|
||||||
listen = [
|
listen = [
|
||||||
{
|
{
|
||||||
|
|
@ -22,6 +27,41 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"www.${domain}" = {
|
||||||
|
forceSSL = true;
|
||||||
|
useACMEHost = "${domain}";
|
||||||
|
|
||||||
|
listen = [
|
||||||
|
{
|
||||||
|
addr = "[::]";
|
||||||
|
port = 8443;
|
||||||
|
ssl = true;
|
||||||
|
proxyProtocol = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
addr = "0.0.0.0";
|
||||||
|
port = 8443;
|
||||||
|
ssl = true;
|
||||||
|
proxyProtocol = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
locations."/" = {
|
||||||
|
return = "302 https://didays.de$request_uri";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = ''
|
||||||
|
# Make use of the ngx_http_realip_module to set the $remote_addr and
|
||||||
|
# $remote_port to the client address and client port, when using proxy
|
||||||
|
# protocol.
|
||||||
|
# First set our proxy protocol proxy as trusted.
|
||||||
|
set_real_ip_from 172.31.17.140;
|
||||||
|
# Then tell the realip_module to get the addreses from the proxy protocol
|
||||||
|
# header.
|
||||||
|
real_ip_header proxy_protocol;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
"${domain}" = {
|
"${domain}" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
useACMEHost = "${domain}";
|
useACMEHost = "${domain}";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue