vm: Provide a simple web server within a VM
This commit is contained in:
parent
7fa4bb5fa6
commit
a7f07853ee
1 changed files with 28 additions and 1 deletions
29
module.nix
29
module.nix
|
|
@ -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";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue