Setup paperless host and reverse proxy for acme http challange
This commit is contained in:
		
					parent
					
						
							
								4c918ad074
							
						
					
				
			
			
				commit
				
					
						ce5e907ed8
					
				
			
		
					 13 changed files with 184 additions and 3 deletions
				
			
		
							
								
								
									
										17
									
								
								config/hosts/web-public-1/configuration.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								config/hosts/web-public-1/configuration.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  boot.loader.grub = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    device = "/dev/vda";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  networking = {    
 | 
			
		||||
    hostName = "web-public-1";
 | 
			
		||||
    firewall = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      allowedTCPPorts = [ 80 443 ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  system.stateVersion = "23.05";
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								config/hosts/web-public-1/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								config/hosts/web-public-1/default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./configuration.nix
 | 
			
		||||
    ./nginx.nix
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								config/hosts/web-public-1/nginx.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								config/hosts/web-public-1/nginx.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./virtualHosts
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  services.nginx = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								config/hosts/web-public-1/virtualHosts/acme-challenge.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								config/hosts/web-public-1/virtualHosts/acme-challenge.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  services.nginx.virtualHosts."paperless.grzb.de" = {
 | 
			
		||||
    listen = [{ 
 | 
			
		||||
      addr = "0.0.0.0";
 | 
			
		||||
      port = 80;
 | 
			
		||||
    }];
 | 
			
		||||
    locations."^~ /.well-known/acme-challenge/" = {
 | 
			
		||||
      proxyPass = "http://paperless.wg.grzb.de:80";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								config/hosts/web-public-1/virtualHosts/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								config/hosts/web-public-1/virtualHosts/default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./acme-challenge.nix
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  services.nginx.virtualHosts."_" = {
 | 
			
		||||
    listen = [{
 | 
			
		||||
        addr = "0.0.0.0";
 | 
			
		||||
        port = 80;
 | 
			
		||||
    }];
 | 
			
		||||
    locations."/" = {
 | 
			
		||||
			return = "301 https://$host$request_uri";
 | 
			
		||||
		};
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue