2023-08-17 21:46:39 +05:00
|
|
|
{ config, ... }:
|
|
|
|
{
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
|
2023-08-18 18:26:54 +05:00
|
|
|
commonHttpConfig = ''
|
|
|
|
# Add HSTS header with preloading to HTTPS requests.
|
|
|
|
# Adding this header to HTTP requests is discouraged
|
|
|
|
map $scheme $hsts_header {
|
|
|
|
https "max-age=31536000; includeSubdomains; preload";
|
|
|
|
}
|
|
|
|
add_header Strict-Transport-Security $hsts_header;
|
|
|
|
'';
|
|
|
|
|
2023-08-17 21:46:39 +05:00
|
|
|
virtualHosts = {
|
2023-08-18 18:22:03 +05:00
|
|
|
"nc.comfycamp.space" = {
|
|
|
|
useACMEHost = "comfycamp.space";
|
|
|
|
forceSSL = true;
|
|
|
|
};
|
2023-08-18 21:13:48 +05:00
|
|
|
"jf.comfycamp.space" = {
|
2023-08-18 21:20:26 +05:00
|
|
|
useACMEHost = "comfycamp.space";
|
|
|
|
forceSSL = true;
|
2023-08-18 21:13:48 +05:00
|
|
|
locations = {
|
|
|
|
"/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:8096";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-08-19 09:17:27 +05:00
|
|
|
"pp.comfycamp.space" = {
|
|
|
|
useACMEHost = "comfycamp.space";
|
|
|
|
forceSSL = true;
|
|
|
|
locations = {
|
|
|
|
"/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:55004";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-08-18 11:21:14 +05:00
|
|
|
"m.comfycamp.space" = {
|
|
|
|
useACMEHost = "comfycamp.space";
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
root = "${config.services.mastodon.package}/public/";
|
|
|
|
|
|
|
|
locations = {
|
|
|
|
"/system/" = {
|
|
|
|
alias = "/var/lib/mastodon/public-system/";
|
|
|
|
};
|
|
|
|
|
|
|
|
"/" = {
|
|
|
|
tryFiles = "$uri @proxy";
|
|
|
|
};
|
|
|
|
|
|
|
|
"@proxy" = {
|
|
|
|
proxyPass = "http://unix:/run/mastodon-web/web.socket";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
"/api/v1/streaming/" = {
|
|
|
|
proxyPass = "http://unix:/run/mastodon-streaming/streaming.socket";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-08-17 21:46:39 +05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-08-18 11:21:14 +05:00
|
|
|
users.users.nginx.extraGroups = [ "acme" ];
|
2023-08-17 21:46:39 +05:00
|
|
|
}
|