diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-08-03 13:07:53 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-08-03 13:07:53 +0200 |
commit | b5ff94dd276b454a400ca0a4616169984189b183 (patch) | |
tree | b87cacb0dab89438ae7e731615a0edb5b085f3bc | |
parent | a5f9003cee87081844a6ea035e891ca59372960c (diff) | |
download | nixos-b5ff94dd276b454a400ca0a4616169984189b183.tar nixos-b5ff94dd276b454a400ca0a4616169984189b183.tar.gz nixos-b5ff94dd276b454a400ca0a4616169984189b183.tar.bz2 nixos-b5ff94dd276b454a400ca0a4616169984189b183.tar.xz nixos-b5ff94dd276b454a400ca0a4616169984189b183.zip |
nginx reverse proxy on bragi
-rw-r--r-- | bragi.nix | 56 |
1 files changed, 55 insertions, 1 deletions
@@ -325,12 +325,66 @@ in rec { | |||
325 | wantedBy = [ "default.target" ]; | 325 | wantedBy = [ "default.target" ]; |
326 | serviceConfig = { | 326 | serviceConfig = { |
327 | Type = "simple"; | 327 | Type = "simple"; |
328 | ExecStart = ''${pkgs.thermoprint-webgui}/bin/thermoprint-webgui -P 8080 -A localhost -a "*" -p 8081''; | 328 | ExecStart = ''${pkgs.thermoprint-webgui}/bin/thermoprint-webgui -P 80 -A localhost -F thermoprint/api -a "*" -p 8081''; |
329 | User = users.extraUsers."thermoprint".name; | 329 | User = users.extraUsers."thermoprint".name; |
330 | Group = users.extraUsers."thermoprint".group; | 330 | Group = users.extraUsers."thermoprint".group; |
331 | }; | 331 | }; |
332 | }; | 332 | }; |
333 | 333 | ||
334 | services.nginx = { | ||
335 | enable = true; | ||
336 | httpConfig = '' | ||
337 | default_type application/octet-stream; | ||
338 | |||
339 | log_format main | ||
340 | '$remote_addr - $remote_user [$time_local] ' | ||
341 | '"$request" $status $bytes_sent ' | ||
342 | '"$http_referer" "$http_user_agent" ' | ||
343 | '"$gzip_ratio"'; | ||
344 | |||
345 | client_header_timeout 10m; | ||
346 | client_body_timeout 10m; | ||
347 | send_timeout 10m; | ||
348 | |||
349 | connection_pool_size 256; | ||
350 | client_header_buffer_size 1k; | ||
351 | large_client_header_buffers 4 2k; | ||
352 | request_pool_size 4k; | ||
353 | |||
354 | gzip on; | ||
355 | gzip_min_length 1100; | ||
356 | gzip_buffers 4 8k; | ||
357 | gzip_types text/plain; | ||
358 | |||
359 | output_buffers 1 32k; | ||
360 | postpone_output 1460; | ||
361 | |||
362 | sendfile on; | ||
363 | tcp_nopush on; | ||
364 | tcp_nodelay on; | ||
365 | |||
366 | keepalive_timeout 75 20; | ||
367 | |||
368 | ignore_invalid_headers on; | ||
369 | |||
370 | access_log stderr; | ||
371 | error_log stderr; | ||
372 | |||
373 | server { | ||
374 | listen *:80; | ||
375 | server_name _; | ||
376 | |||
377 | location /thermoprint/api { | ||
378 | proxy_pass http://localhost:8081; | ||
379 | } | ||
380 | |||
381 | location /thermoprint { | ||
382 | proxy_pass http://localhost:8080; | ||
383 | } | ||
384 | } | ||
385 | ''; | ||
386 | }; | ||
387 | |||
334 | nix = { | 388 | nix = { |
335 | daemonIONiceLevel = 3; | 389 | daemonIONiceLevel = 3; |
336 | daemonNiceLevel = 10; | 390 | daemonNiceLevel = 10; |