2025-03-23 21:48:46 +00:00
|
|
|
{
|
2024-02-04 20:51:11 +00:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
|
2024-10-31 23:40:42 +00:00
|
|
|
recommendedGzipSettings = true;
|
2024-02-04 20:51:11 +00:00
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
2024-08-21 16:59:24 +00:00
|
|
|
|
2024-02-14 22:06:49 +00:00
|
|
|
commonHttpConfig = ''
|
|
|
|
error_log stderr;
|
|
|
|
access_log /var/log/nginx/access.log;
|
|
|
|
'';
|
|
|
|
|
2025-03-23 21:48:46 +00:00
|
|
|
virtualHosts = let
|
|
|
|
matchAll = ''~.*'';
|
|
|
|
matchWww = ''~^www\.(?<domain>.+)$'';
|
|
|
|
in {
|
|
|
|
# Redirect anything that doesn't match any server name to networking.domain
|
|
|
|
${matchAll} = {
|
|
|
|
default = true;
|
|
|
|
rejectSSL = true;
|
2024-02-14 22:06:49 +00:00
|
|
|
|
2025-03-23 21:48:46 +00:00
|
|
|
globalRedirect = "wrz.one";
|
|
|
|
};
|
|
|
|
# Redirect www to non-www
|
|
|
|
${matchWww}.globalRedirect = "$domain";
|
2024-02-14 22:06:49 +00:00
|
|
|
};
|
2024-02-04 20:51:11 +00:00
|
|
|
};
|
|
|
|
}
|