caddy and hello world container
This commit is contained in:
parent
4577585e2c
commit
f52e433423
3 changed files with 41 additions and 0 deletions
12
caddy.nix
Normal file
12
caddy.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.caddy = {
|
||||||
|
enable = true;
|
||||||
|
email = "admin@srazka.com"; # Replace with your actual email
|
||||||
|
|
||||||
|
# The new hello container
|
||||||
|
virtualHosts."hello.srazka.com".extraConfig = ''
|
||||||
|
reverse_proxy 192.168.100.11:80
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
27
containers/hello.nix
Normal file
27
containers/hello.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
containers.hello = {
|
||||||
|
autoStart = true;
|
||||||
|
privateNetwork = true;
|
||||||
|
hostAddress = "192.168.100.10";
|
||||||
|
localAddress = "192.168.100.11";
|
||||||
|
|
||||||
|
config = { config, pkgs, ... }: {
|
||||||
|
system.stateVersion = "25.11";
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."localhost" = {
|
||||||
|
# Return a 200 OK directly from nginx
|
||||||
|
locations."/".return = "200 'Hello world!'";
|
||||||
|
locations."/".extraConfig = ''
|
||||||
|
default_type text/plain;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
modules = [
|
modules = [
|
||||||
vpsadminos.nixosModules.container_25_11
|
vpsadminos.nixosModules.container_25_11
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
|
./caddy.nix
|
||||||
|
./containers/hello.nix
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue