Enable proxyprotocol for nitter host
This commit is contained in:
		
					parent
					
						
							
								a4f3e68aac
							
						
					
				
			
			
				commit
				
					
						70eb8625bc
					
				
			
		
					 7 changed files with 29 additions and 52 deletions
				
			
		| 
						 | 
					@ -45,6 +45,7 @@ in
 | 
				
			||||||
      site = "vs";
 | 
					      site = "vs";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    nitter = {
 | 
					    nitter = {
 | 
				
			||||||
 | 
					      hostNixpkgs = nixpkgs-unstable;
 | 
				
			||||||
      site = "vs";
 | 
					      site = "vs";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    nixos-coturn = {
 | 
					    nixos-coturn = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  networking = {
 | 
					  networking = {
 | 
				
			||||||
    hostName = "nitter";
 | 
					    hostName = "nitter";
 | 
				
			||||||
    firewall.enable = false;
 | 
					    firewall = {
 | 
				
			||||||
 | 
					      enable = true;
 | 
				
			||||||
 | 
					      allowedTCPPorts = [ 8443 ];
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  system.stateVersion = "23.05";
 | 
					  system.stateVersion = "23.05";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,28 +1,28 @@
 | 
				
			||||||
{ ... }:
 | 
					{ config, ... }:
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  services.nginx = {
 | 
					  services.nginx = {
 | 
				
			||||||
    enable = true;
 | 
					    enable = true;
 | 
				
			||||||
    enableReload = true;
 | 
					    virtualHosts."birdsite.nekover.se" = {
 | 
				
			||||||
    recommendedGzipSettings = true;
 | 
					      forceSSL = true;
 | 
				
			||||||
    recommendedOptimisation = true;
 | 
					      enableACME = true;
 | 
				
			||||||
    recommendedProxySettings = true;
 | 
					      listen = [
 | 
				
			||||||
    recommendedTlsSettings = true;
 | 
					        { 
 | 
				
			||||||
 | 
					          addr = "localhost";
 | 
				
			||||||
    virtualHosts = {
 | 
					          port = 1234;
 | 
				
			||||||
      "nixos-nitter.vs.grzb.de" = {
 | 
					        } # workaround for enableACME check
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          addr = "0.0.0.0";
 | 
				
			||||||
 | 
					          port = 8443;
 | 
				
			||||||
 | 
					          ssl = true;
 | 
				
			||||||
 | 
					          proxyProtocol = true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      ];
 | 
				
			||||||
      locations."/robots.txt" = {
 | 
					      locations."/robots.txt" = {
 | 
				
			||||||
        return = "200 \"User-agent: *\\nDisallow: /\\n\"";
 | 
					        return = "200 \"User-agent: *\\nDisallow: /\\n\"";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					 | 
				
			||||||
      locations."/" = {
 | 
					      locations."/" = {
 | 
				
			||||||
          proxyPass = "http://localhost:8080";
 | 
					        proxyPass = "http://${config.services.nitter.server.address}:${builtins.toString config.services.nitter.server.port}";
 | 
				
			||||||
          extraConfig =
 | 
					        proxyWebsockets = true;
 | 
				
			||||||
            "proxy_http_version 1.1;" +
 | 
					 | 
				
			||||||
            "proxy_set_header Upgrade $http_upgrade;" +
 | 
					 | 
				
			||||||
            "proxy_set_header Connection \"upgrade\";" +
 | 
					 | 
				
			||||||
            "proxy_set_header Host $host;"
 | 
					 | 
				
			||||||
            ;
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
    server = {
 | 
					    server = {
 | 
				
			||||||
      title = "Birdsite";
 | 
					      title = "Birdsite";
 | 
				
			||||||
      https = true;
 | 
					      https = true;
 | 
				
			||||||
      address = "0.0.0.0";
 | 
					      address = "127.0.0.1";
 | 
				
			||||||
      port = 8080;
 | 
					      port = 8080;
 | 
				
			||||||
      hostname = "birdsite.nekover.se";
 | 
					      hostname = "birdsite.nekover.se";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@
 | 
				
			||||||
    streamConfig = ''
 | 
					    streamConfig = ''
 | 
				
			||||||
      map $ssl_preread_server_name $address {
 | 
					      map $ssl_preread_server_name $address {
 | 
				
			||||||
        anisync.grzb.de 127.0.0.1:8443;
 | 
					        anisync.grzb.de 127.0.0.1:8443;
 | 
				
			||||||
        birdsite.nekover.se 127.0.0.1:8443;
 | 
					        birdsite.nekover.se 10.202.41.107:8443;
 | 
				
			||||||
        cloud.nekover.se 10.202.41.122:8443;
 | 
					        cloud.nekover.se 10.202.41.122:8443;
 | 
				
			||||||
        element.nekover.se 127.0.0.1:8443;
 | 
					        element.nekover.se 127.0.0.1:8443;
 | 
				
			||||||
        gameserver.grzb.de 127.0.0.1:8443;
 | 
					        gameserver.grzb.de 127.0.0.1:8443;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,26 +0,0 @@
 | 
				
			||||||
{ ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  services.nginx.virtualHosts."birdsite.nekover.se" = {
 | 
					 | 
				
			||||||
    forceSSL = true;
 | 
					 | 
				
			||||||
    enableACME = true;
 | 
					 | 
				
			||||||
    listen = [
 | 
					 | 
				
			||||||
      { 
 | 
					 | 
				
			||||||
        addr = "localhost";
 | 
					 | 
				
			||||||
        port = 1234;
 | 
					 | 
				
			||||||
      } # workaround for enableACME check
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        addr = "localhost";
 | 
					 | 
				
			||||||
        port = 8443;
 | 
					 | 
				
			||||||
        ssl = true;
 | 
					 | 
				
			||||||
        proxyProtocol = true;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
    locations."/" = {
 | 
					 | 
				
			||||||
      proxyPass = "http://nitter.vs.grzb.de:8080";
 | 
					 | 
				
			||||||
      proxyWebsockets = true;
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    locations."/robots.txt" = {
 | 
					 | 
				
			||||||
      return = "200 \"User-agent: *\\nDisallow: /\\n\"";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,6 @@
 | 
				
			||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
    ./acme-challenge.nix
 | 
					    ./acme-challenge.nix
 | 
				
			||||||
    ./anisync.grzb.de.nix
 | 
					    ./anisync.grzb.de.nix
 | 
				
			||||||
    ./birdsite.nekover.se.nix
 | 
					 | 
				
			||||||
    ./element.nekover.se.nix
 | 
					    ./element.nekover.se.nix
 | 
				
			||||||
    ./gameserver.grzb.de.nix
 | 
					    ./gameserver.grzb.de.nix
 | 
				
			||||||
    ./git.grzb.de.nix
 | 
					    ./git.grzb.de.nix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue