vm: Provide a simple web server within a VM

This commit is contained in:
Alexander Kobjolke 2024-01-14 13:02:24 +01:00
parent 7fa4bb5fa6
commit a7f07853ee

View file

@ -1,2 +1,29 @@
{ services.getty.autologinUser = "root"; { pkgs, ... }: {
services = {
getty.autologinUser = "root";
nginx = {
enable = true;
virtualHosts.localhost.locations."/" = {
index = "index.html";
root = pkgs.writeTextDir "index.html" ''
<html>
<body>
Hello World!
</body>
</html>
'';
};
};
};
networking.firewall.allowedTCPPorts = [ 80 ];
virtualisation.forwardPorts = [{
from = "host";
guest.port = 80;
host.port = 8080;
}];
system.stateVersion = "23.11";
} }