Browse Source

New module for nginx

pjones/monitoring
Peter J. Jones 9 months ago
parent
commit
6c7065945c
Signed by: Peter Jones <pjones@devalot.com> GPG Key ID: 9DAFAA8D01941E49
3 changed files with 44 additions and 0 deletions
  1. 7
    0
      README.md
  2. 1
    0
      modules/services/web/default.nix
  3. 36
    0
      modules/services/web/nginx/default.nix

+ 7
- 0
README.md View File

@@ -9,6 +9,13 @@ Module List

Automatically enable various security related settings for NixOS.

* `phoebe.services.nginx`:

Extra configuration for nginx (if it's enabled elsewhere). For
example, automatically use syslog so no log files need to be
rotated. See the `phoebe.services.nginx.syslog` option for more
details.

* `phoebe.services.postgresql`:

Start and manage PostgreSQL, including automatic user and database

+ 1
- 0
modules/services/web/default.nix View File

@@ -2,6 +2,7 @@

{
imports = [
./nginx
./rails
];
}

+ 36
- 0
modules/services/web/nginx/default.nix View File

@@ -0,0 +1,36 @@
# Extra configuration for nginx:
{ config, lib, pkgs, ...}:

# Bring in library functions:
with lib;

let
##############################################################################
# Save some typing.
cfg = config.phoebe.services.nginx;

in
{
#### Interface
options.phoebe.services.nginx = {
syslog = mkOption {
type = types.bool;
default = true;
description = ''
Whether to send nginx logging to syslog/journald.

This option only applies if nginx is enabled.
'';
};
};

#### Implementation
config = mkMerge [
(mkIf (config.services.nginx.enable && cfg.syslog) {
services.nginx.commonHttpConfig = ''
access_log syslog:server=unix:/dev/log;
error_log syslog:server=unix:/dev/log;
'';
})
];
}

Loading…
Cancel
Save