2024-10-25 21:31:27 -04:00
|
|
|
{ pkgs, ... }: {
|
2024-10-25 18:00:18 -04:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
2024-10-25 21:31:27 -04:00
|
|
|
package = pkgs.nginx.override {
|
2024-10-25 18:00:18 -04:00
|
|
|
modules = with pkgs.nginxModules; [ rtmp ];
|
2024-10-25 21:31:27 -04:00
|
|
|
};
|
2024-10-25 18:00:18 -04:00
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
2024-10-25 21:31:27 -04:00
|
|
|
|
2024-10-25 18:00:18 -04:00
|
|
|
virtualHosts = {
|
2024-10-25 21:31:27 -04:00
|
|
|
"www.lunamoonlight.xyz" = {
|
2024-10-25 18:00:18 -04:00
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
2024-10-25 21:38:49 -04:00
|
|
|
root = "/var/www/luna";
|
2024-10-25 21:31:27 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
# Nextcloud Proxy
|
|
|
|
"nextcloud.lunamoonlight.xyz" = {
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyWebsockets = true;
|
|
|
|
extraConfig = ''
|
|
|
|
location /.well-known/carddav {
|
|
|
|
return 301 $scheme://$host/remote.php/dav;
|
|
|
|
}
|
|
|
|
location /.well-known/caldav {
|
|
|
|
return 301 $scheme://$host/remote.php/dav;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
appendConfig = ''
|
|
|
|
rtmp {
|
|
|
|
server {
|
|
|
|
listen 1935;
|
|
|
|
chunk_size 4096;
|
|
|
|
allow publish all;
|
|
|
|
application stream {
|
|
|
|
record off;
|
|
|
|
live on;
|
|
|
|
allow play all;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
# Nextcloud server
|
|
|
|
services.nextcloud = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.nextcloud29;
|
|
|
|
hostName = "nextcloud.lunamoonlight.xyz";
|
|
|
|
datadir = "/mnt/nextcloud";
|
|
|
|
https = true;
|
|
|
|
config = {
|
|
|
|
adminuser = "luna";
|
|
|
|
adminpassFile = "/mnt/nextcloud/password.txt";
|
|
|
|
};
|
|
|
|
settings = {
|
|
|
|
trusted_proxies = [ "127.0.0.1" ];
|
2024-10-25 21:49:05 -04:00
|
|
|
trusted_domains = [
|
|
|
|
"nextcloud.lunamoonlight.xyz"
|
|
|
|
"www.lunamoonlight.xyz" # Add this line
|
|
|
|
];
|
2024-10-25 21:31:27 -04:00
|
|
|
overwriteprotocol = "https";
|
|
|
|
};
|
|
|
|
};
|
2024-10-25 18:00:18 -04:00
|
|
|
|
2024-10-25 21:31:27 -04:00
|
|
|
# Open HTTP and HTTPS ports
|
2024-10-25 18:00:18 -04:00
|
|
|
networking.firewall = {
|
2024-10-25 21:31:27 -04:00
|
|
|
allowedTCPPorts = [ 80 443 ];
|
2024-10-25 18:00:18 -04:00
|
|
|
};
|
|
|
|
}
|