Commit Graph

342 Commits

Author SHA1 Message Date
Sandro Jäckel
157256f9dd nixos/nginx: filter more options when listening has quic 2023-12-23 02:20:48 +01:00
Izorkin
86efccfa45 angie: init at 1.4.0 2023-12-17 22:43:13 +03:00
Ryan Lahfa
3bb93fb2cd Merge pull request #271506 from Misterio77/nginx-redirect-status-code 2023-12-12 14:05:33 +01:00
Gabriel Fontes
a3c60d2ddc nixos/nginx: make redirect status code configurable
Add an option to configure which code globalRedirect and forceSSL use.
It previously was always 301 with no easy way to override.
2023-12-11 11:09:02 -03:00
Sandro Jäckel
78541e68eb nixos/nginx: allow return to be an int 2023-12-08 15:04:27 +01:00
phaer
c40f706dc4 nixos/nginx/tailscale-auth: init module 2023-12-06 20:57:38 +01:00
Anthony Roussel
e30f48be94 treewide: fix redirected and broken URLs
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-11-11 10:49:01 +01:00
Artturi
61f2bd3178 Merge pull request #254386 from erikarvstedt/nginx-js-mime-type 2023-10-27 23:32:20 +03:00
Sandro
f4d631c3d1 nixos/nginx: document implicit default port 80 2023-10-22 21:32:50 +02:00
Carl Dong
e5c2c71280 nixos/nginx: Allow empty port for listen directive
When listening on unix sockets, it doesn't make sense to specify a port
for nginx's listen directive.

Since nginx defaults to port 80 when the port isn't specified (but the
address is), we can change the default for the option to null as well
without changing any behaviour.
2023-10-09 21:16:03 -04:00
Marek Beyer
ea1eb4ee0f nixos/nginx: add systemd-tmpfiles exclusion of temporary directories
Directories used by nginx in the tmp path are only created upon startup and
must not be deleted while nginx is running.
2023-10-06 14:26:37 +02:00
Izorkin
64fe8c9292 nixos/nginx: allow enabling QUIC packet routing using eBPF 2023-09-19 16:16:34 +03:00
Erik Arvstedt
7ce5fa1a82 nixos/nginx: add application/javascript to compressMimeTypes
Although deprecated, this MIME type is still used by various
applications and web frameworks which are potentially proxied by nginx.

Examples:
- Apps based on ASP.NET Core
- Apps based on http.server (Python)
2023-09-10 13:56:23 +02:00
Sandro
c6af5494aa nixos/nginx: fix services.nginx.defaultListen description 2023-09-03 16:45:10 +02:00
Izorkin
cf7cea3287 nixos/nginx: using new variant of http2 directive 2023-08-03 07:09:02 +03:00
Ryan Lahfa
899b60de3f Merge pull request #245893 from h7x4/move-nginx-status-page-declaration 2023-07-29 20:22:58 +02:00
h7x4
d803f78e7c nixos/nginx: move status page config to services.nginx 2023-07-28 20:29:09 +02:00
oddlama
cbdaab0f17 nixos/nginx: remove unnecessary acme locations to allow double proxied setups 2023-07-27 15:30:38 +02:00
Joe Edmonds
f87892b50b nixos/modules/web-servers/nginx/default.nix: fix minor typo 2023-06-06 21:55:15 -07:00
Raito Bezarius
69bb0f94de nixos/nginx: first-class PROXY protocol support
PROXY protocol is a convenient way to carry information about the
originating address/port of a TCP connection across multiple layers of
proxies/NAT, etc.

Currently, it is possible to make use of it in NGINX's NixOS module, but
is painful when we want to enable it "globally".
Technically, this is achieved by reworking the defaultListen options and
the objective is to have a coherent way to specify default listeners in
the current API design.
See `mkDefaultListenVhost` and `defaultListen` for the details.

It adds a safeguard against running a NGINX with no HTTP listeners (e.g.
only PROXY listeners) while asking for ACME certificates over HTTP-01.

An interesting usecase of PROXY protocol is to enable seamless IPv4 to
IPv6 proxy with origin IPv4 address for IPv6-only NGINX servers, it is
demonstrated how to achieve this in the tests, using sniproxy.

Finally, the tests covers:

- NGINX `defaultListen` mechanisms are not broken by these changes;
- NGINX PROXY protocol listeners are working in a final usecase
  (sniproxy);
- uses snakeoil TLS certs from ACME setup with wildcard certificates;

In the future, it is desirable to spoof-attack NGINX in this scenario to
ascertain that `set_real_ip_from` and all the layers are working as
intended and preventing any user from setting their origin IP address to
any arbitrary, opening up the NixOS module to bad™ vulnerabilities.

For now, it is quite hard to achieve while being minimalistic about the
tests dependencies.
2023-05-26 19:48:26 +02:00
Izorkin
2809915f19 nixos/nginx: allow arbitrary parameters in upstream servers
Adds a `freeformType` to `services.nginx.upstreams.<name>.servers` to
allow setting arbitrary parameters.
2023-05-07 11:17:49 +02:00
sandydoo
2086b377cf nixos/nginx: serve the status page on localhost servers
The status page is inaccessible by default, unless a virtual host is
added with a `server_name` that's not `localhost`.

This commit moves the status page configuration, so that
it's matched before the main server blocks.
2023-04-28 07:20:36 +00:00
Jan Tojnar
e25dc4a95e nixos/nginx: Fix listen string generation
This regressed in 327b0cff7a breaking nixosTests.php, among other things.
2023-04-21 17:18:45 +02:00
Artturi
b83db86a9e Merge pull request #222080 from Stunkymonkey/nixos-optionalString 2023-04-20 16:07:30 +03:00
K900
c29ccca1a3 Merge pull request #222923 from oddlama/fix-nginx-duplicate-mime
nixos/nginx: fix warning about duplicate mime entry
2023-04-09 14:58:39 +03:00
Felix Buehler
327b0cff7a treewide: use more lib.optionalString 2023-04-07 13:38:33 +02:00
Franz Pletz
0e950a1ec7 Merge pull request #223085 from Izorkin/update-nginx-proxy-cache
nixos/nginx: enable multiple proxyCachePath support
2023-04-06 02:52:44 +02:00
Sandro
44bdb9ce9f Merge pull request #223091 from Izorkin/update-nginx-compression 2023-04-02 00:32:47 +02:00
Izorkin
427ae14373 nixos/nginx: update description in compression modules 2023-04-01 13:56:26 +03:00
Izorkin
8a289bcc79 nixos/nginx: enable multiple proxyCachePath support 2023-04-01 13:55:56 +03:00
Izorkin
77d6fd36cf nixos/nginx: update quic configuration 2023-04-01 13:09:49 +03:00
oddlama
ba0a1611fc nixos/nginx: fix warning about duplicate mime entry 2023-03-24 19:44:00 +01:00
Sandro
995f9d1c95 Merge pull request #213874 from SuperSandro2000/nginx-zstd
nixos/nginx: add recommendedZstdSettings
2023-03-23 14:11:35 +01:00
Izorkin
5eb5d881a4 nixos/nginx: add defaultMimeTypes option 2023-03-07 19:37:18 +03:00
Sandro Jäckel
5e5a84b193 nixos/nginx: add recommendedZstdSettings 2023-02-22 13:59:53 +01:00
Sandro
6cdec6d1b8 nixos/nginx: add comment about clearing Connection header (#214211) 2023-02-06 23:37:38 +01:00
Nick Cao
4840ca34f4 Merge pull request #213626 from jamesreprise/entries-typo
nginx: fix typo in commonHttpConfig
2023-02-02 09:12:32 +08:00
Sandro
600adcfdcc Merge pull request #187994 from Izorkin/update-nginx-gzip 2023-01-31 20:41:59 +01:00
Izorkin
d178a1d7a1 nixos/nginx: update recommended brotli settings 2023-01-30 23:13:12 +03:00
Izorkin
ee7e096c48 nixos/nginx: update recommended gzip settings 2023-01-30 23:03:01 +03:00
Sandro Jäckel
2d3efd3301 nixos/nginx: clear clients Connection headers 2023-01-30 20:25:22 +01:00
James Williams
18ab2268cd fix: typo (enries -> entries) 2023-01-30 19:08:30 +00:00
Guillaume Girol
cb73862665 Revert "nixos/nginx: validate syntax of config file at build time"
This reverts commit a768871934.

This is too fragile, it breaks at least on:
* ssl dh params
* hostnames in proxypass and upstreams are resolved in the sandbox
2023-01-20 20:10:19 +01:00
Guillaume Girol
ecb06398e7 Revert "nixos/nginx: disable configuration validation for now"
This reverts commit 7ef58bce9d.
2023-01-20 20:07:47 +01:00
Sandro Jäckel
b973513d04 nixos/nginx: cleanup, remove old todo 2023-01-09 22:04:06 +01:00
Kevin Cox
c930fd9517 Merge pull request #207874 from kevincox/nginx-unique
nixos/nginx: Deduplicate modules.
2023-01-03 13:07:43 -05:00
Izorkin
4a7d0140a0 nixos/nginx: add recommended brotli settings 2022-12-29 18:14:35 +03:00
Kevin Cox
487b51e77c nixos/nginx: Deduplicate modules.
In most places in NixOS defining an option multiple places just merges the result together. This is particularly useful if you have two modules that both need an option, you don't want to have problems when they both set it. This makes the nginx `additionalModules` option follow this pattern.
2022-12-26 15:47:51 -05:00
Jörg Thalheim
7ef58bce9d nixos/nginx: disable configuration validation for now
There still seem a lot of breakages not addressed yet:

https://github.com/NixOS/nixpkgs/pull/205561
2022-12-24 09:25:43 +01:00
Guillaume Girol
92dbac3199 Merge pull request #205561 from symphorien/nginx-conf-validate
nixos/nginx: validate config at build time
2022-12-19 19:52:33 +00:00