Nginx: Difference between revisions

Extra Config section added
m Documented configuration of nginx modules and where to find the module definitions.
 
(2 intermediate revisions by 2 users not shown)
Line 35: Line 35:
   };
   };
};
};
# Optional: You can configure the email address used with Let's Encrypt.
 
# This way you get renewal reminders (automated by NixOS) as well as expiration emails.
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme.certs = {
 
   "blog.example.com".email = "youremail@address.com";
security.acme = {
  # Accept the CA’s terms of service. The default provider is Let’s Encrypt, you can find their ToS at https://letsencrypt.org/repository/.
  acceptTerms = true;
  # Optional: You can configure the email address used with Let's Encrypt.
  # This way you get renewal reminders (automated by NixOS) as well as expiration emails.
   defaults.email = "youremail@address.com";
};
};
</syntaxhighlight>
</syntaxhighlight>
Line 282: Line 287:
systemd.services.hedgedoc.serviceConfig.UMask = "0000";
systemd.services.hedgedoc.serviceConfig.UMask = "0000";
</syntaxhighlight>
</syntaxhighlight>
== Modules ==
Nginx can be run with optional modules. You can add them like this:
  services.nginx.package = (pkgs.nginx.override { modules = [
    pkgs.nginxModules.dav
    pkgs.nginxModules.lua
    ...
  ]; });
See [https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/nginx/modules.nix#L69 this] for a more comprehensive list of modules available via configuration.
== Let's Encrypt certificates ==
== Let's Encrypt certificates ==


Line 445: Line 460:
== Extra config ==
== Extra config ==


Appart native options, Nix allows to specify verbatim Nginx configuration. Some options are mutually exclusive.
Apart native options, Nix allows to specify verbatim Nginx configuration. Some options are mutually exclusive.


Below table assumes "services.nginx." prefix for all options. These options allows to keep using Nix configuration file while taking advantage of Nginx features which are not representend in options.
Below table assumes "services.nginx." prefix for all options. These options allows to keep using Nix configuration file while taking advantage of Nginx features which are not representend in options.