forked from CCCHH/nix-infra
Configure NetBox
This commit is contained in:
parent
e0c7180ecf
commit
2e3e8c7031
6 changed files with 121 additions and 1 deletions
61
config/hosts/netbox/nginx.nix
Normal file
61
config/hosts/netbox/nginx.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
# Sources for this configuration:
|
||||
# - https://nixos.org/manual/nixos/stable/#module-security-acme
|
||||
# - https://git.grzb.de/yuri/nix-infra/-/blob/33f2d9e324c2e3a8b1b41c20bce239001bcce9fc/hosts/netbox/nginx.nix
|
||||
# - https://docs.netbox.dev/en/stable/installation/5-http-server/
|
||||
# - https://github.com/netbox-community/netbox/blob/v3.5.9/contrib/nginx.conf
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
# So nginx can access the Netbox static files.
|
||||
user = "netbox";
|
||||
|
||||
virtualHosts."acme-netbox.ccchh.net" = {
|
||||
default = true;
|
||||
enableACME = true;
|
||||
serverName = "netbox.ccchh.net";
|
||||
|
||||
listen = [
|
||||
{
|
||||
addr = "0.0.0.0";
|
||||
port = 31820;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
virtualHosts."netbox.ccchh.net" = {
|
||||
default = true;
|
||||
forceSSL = true;
|
||||
useACMEHost = "netbox.ccchh.net";
|
||||
|
||||
listen = [
|
||||
{
|
||||
addr = "0.0.0.0";
|
||||
port = 80;
|
||||
}
|
||||
{
|
||||
addr = "0.0.0.0";
|
||||
port = 443;
|
||||
ssl = true;
|
||||
}
|
||||
];
|
||||
|
||||
locations."/static/" = {
|
||||
alias = "${config.services.netbox.dataDir}/static/";
|
||||
};
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://${config.services.netbox.listenAddress}:${builtins.toString config.services.netbox.port}";
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
client_max_body_size 25m;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 31820 ];
|
||||
networking.firewall.allowedUDPPorts = [ 443 ];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue