File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
modules/services/web-servers/nginx Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 339339 map (
340340 listen :
341341 {
342- port = cfg . defaultSSLListenPort ;
342+ port = if ( hasPrefix "unix:" listen . addr ) then null else cfg . defaultSSLListenPort ;
343343 ssl = true ;
344344 }
345345 // listen
351351 map (
352352 listen :
353353 {
354- port = cfg . defaultHTTPListenPort ;
354+ port = if ( hasPrefix "unix:" listen . addr ) then null else cfg . defaultHTTPListenPort ;
355355 ssl = false ;
356356 }
357357 // listen
Original file line number Diff line number Diff line change 11{ ... } :
22let
3+ defaultNginxSocketPath = "/var/run/nginx/default-test.sock" ;
34 nginxSocketPath = "/var/run/nginx/test.sock" ;
45in
56{
1112 {
1213 services . nginx = {
1314 enable = true ;
15+
16+ defaultListen = [ { addr = "unix:${ defaultNginxSocketPath } " ; } ] ;
17+ virtualHosts . defaultLocalhost = {
18+ serverName = "defaultLocalhost" ;
19+ locations . "/default" . return = "200 'bar'" ;
20+ } ;
21+
1422 virtualHosts . localhost = {
1523 serverName = "localhost" ;
1624 listen = [ { addr = "unix:${ nginxSocketPath } " ; } ] ;
2230
2331 testScript = ''
2432 webserver.wait_for_unit("nginx")
25- webserver.wait_for_open_unix_socket("${ nginxSocketPath } ")
33+ webserver.wait_for_open_unix_socket("${ defaultNginxSocketPath } ", timeout=1)
34+ webserver.wait_for_open_unix_socket("${ nginxSocketPath } ", timeout=1)
2635
36+ webserver.succeed("curl --fail --silent --unix-socket '${ defaultNginxSocketPath } ' http://defaultLocalhost/default | grep '^bar$'")
2737 webserver.succeed("curl --fail --silent --unix-socket '${ nginxSocketPath } ' http://localhost/test | grep '^foo$'")
2838 '' ;
2939}
You can’t perform that action at this time.
0 commit comments