mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 04:05:40 +03:00
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.
This commit is contained in:
parent
354d127959
commit
e5c2c71280
6 changed files with 57 additions and 6 deletions
27
nixos/tests/nginx-unix-socket.nix
Normal file
27
nixos/tests/nginx-unix-socket.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
import ./make-test-python.nix ({ pkgs, ... }:
|
||||
let
|
||||
nginxSocketPath = "/var/run/nginx/test.sock";
|
||||
in
|
||||
{
|
||||
name = "nginx-unix-socket";
|
||||
|
||||
nodes = {
|
||||
webserver = { pkgs, lib, ... }: {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts.localhost = {
|
||||
serverName = "localhost";
|
||||
listen = [{ addr = "unix:${nginxSocketPath}"; }];
|
||||
locations."/test".return = "200 'foo'";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
webserver.wait_for_unit("nginx")
|
||||
webserver.wait_for_open_unix_socket("${nginxSocketPath}")
|
||||
|
||||
webserver.succeed("curl --fail --silent --unix-socket '${nginxSocketPath}' http://localhost/test | grep '^foo$'")
|
||||
'';
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue