tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/peertube: update nginx configuration
Izorkin
3 years ago
32673128
1915c85b
+79
-17
1 changed file
expand all
collapse all
unified
split
nixos
modules
services
web-apps
peertube.nix
+79
-17
nixos/modules/services/web-apps/peertube.nix
reviewed
···
549
549
'';
550
550
};
551
551
552
552
+
locations."~ ^/plugins/[^/]+(/[^/]+)?/ws/" = {
553
553
+
tryFiles = "/dev/null @api_websocket";
554
554
+
priority = 1230;
555
555
+
};
556
556
+
552
557
locations."@api_websocket" = {
553
558
proxyPass = "http://127.0.0.1:${toString cfg.listenHttp}";
554
554
-
priority = 1230;
559
559
+
priority = 1240;
555
560
556
561
extraConfig = ''
557
562
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
···
582
587
'';
583
588
};
584
589
585
585
-
locations."~ ^/lazy-static/(avatars|banners)/" = {
590
590
+
locations."^~ /lazy-static/avatars/" = {
586
591
tryFiles = "$uri @api";
587
592
root = cfg.settings.storage.avatars;
588
593
priority = 1330;
···
600
605
add_header Cache-Control 'public, max-age=7200';
601
606
602
607
rewrite ^/lazy-static/avatars/(.*)$ /$1 break;
608
608
+
'';
609
609
+
};
610
610
+
611
611
+
locations."^~ /lazy-static/banners/" = {
612
612
+
tryFiles = "$uri @api";
613
613
+
root = cfg.settings.storage.avatars;
614
614
+
priority = 1340;
615
615
+
extraConfig = ''
616
616
+
if ($request_method = 'OPTIONS') {
617
617
+
${nginxCommonHeaders}
618
618
+
add_header Access-Control-Max-Age 1728000;
619
619
+
add_header Cache-Control 'no-cache';
620
620
+
add_header Content-Type 'text/plain charset=UTF-8';
621
621
+
add_header Content-Length 0;
622
622
+
return 204;
623
623
+
}
624
624
+
625
625
+
${nginxCommonHeaders}
626
626
+
add_header Cache-Control 'public, max-age=7200';
627
627
+
603
628
rewrite ^/lazy-static/banners/(.*)$ /$1 break;
604
629
'';
605
630
};
···
607
632
locations."^~ /lazy-static/previews/" = {
608
633
tryFiles = "$uri @api";
609
634
root = cfg.settings.storage.previews;
610
610
-
priority = 1340;
635
635
+
priority = 1350;
611
636
extraConfig = ''
612
637
if ($request_method = 'OPTIONS') {
613
638
${nginxCommonHeaders}
···
625
650
'';
626
651
};
627
652
653
653
+
locations."^~ /static/streaming-playlists/private/" = {
654
654
+
proxyPass = "http://127.0.0.1:${toString cfg.listenHttp}";
655
655
+
priority = 1410;
656
656
+
extraConfig = ''
657
657
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
658
658
+
proxy_set_header Host $host;
659
659
+
proxy_set_header X-Real-IP $remote_addr;
660
660
+
661
661
+
proxy_limit_rate 5M;
662
662
+
'';
663
663
+
};
664
664
+
665
665
+
locations."^~ /static/webseed/private/" = {
666
666
+
proxyPass = "http://127.0.0.1:${toString cfg.listenHttp}";
667
667
+
priority = 1420;
668
668
+
extraConfig = ''
669
669
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
670
670
+
proxy_set_header Host $host;
671
671
+
proxy_set_header X-Real-IP $remote_addr;
672
672
+
673
673
+
proxy_limit_rate 5M;
674
674
+
'';
675
675
+
};
676
676
+
628
677
locations."^~ /static/thumbnails/" = {
629
678
tryFiles = "$uri @api";
630
679
root = cfg.settings.storage.thumbnails;
631
631
-
priority = 1350;
680
680
+
priority = 1430;
632
681
extraConfig = ''
633
682
if ($request_method = 'OPTIONS') {
634
683
${nginxCommonHeaders}
···
649
698
locations."^~ /static/redundancy/" = {
650
699
tryFiles = "$uri @api";
651
700
root = cfg.settings.storage.redundancy;
652
652
-
priority = 1360;
701
701
+
priority = 1440;
653
702
extraConfig = ''
703
703
+
set $peertube_limit_rate 800k;
704
704
+
705
705
+
if ($request_uri ~ -fragmented.mp4$) {
706
706
+
set $peertube_limit_rate 5M;
707
707
+
}
708
708
+
654
709
if ($request_method = 'OPTIONS') {
655
710
${nginxCommonHeaders}
656
711
add_header Access-Control-Max-Age 1728000;
···
663
718
664
719
access_log off;
665
720
}
721
721
+
666
722
aio threads;
667
723
sendfile on;
668
724
sendfile_max_chunk 1M;
669
725
726
726
+
limit_rate $peertube_limit_rate;
670
727
limit_rate_after 5M;
671
671
-
672
672
-
set $peertube_limit_rate 800k;
673
673
-
set $limit_rate $peertube_limit_rate;
674
728
675
729
rewrite ^/static/redundancy/(.*)$ /$1 break;
676
730
'';
···
679
733
locations."^~ /static/streaming-playlists/" = {
680
734
tryFiles = "$uri @api";
681
735
root = cfg.settings.storage.streaming_playlists;
682
682
-
priority = 1370;
736
736
+
priority = 1450;
683
737
extraConfig = ''
738
738
+
set $peertube_limit_rate 800k;
739
739
+
740
740
+
if ($request_uri ~ -fragmented.mp4$) {
741
741
+
set $peertube_limit_rate 5M;
742
742
+
}
743
743
+
684
744
if ($request_method = 'OPTIONS') {
685
745
${nginxCommonHeaders}
686
746
add_header Access-Control-Max-Age 1728000;
···
698
758
sendfile on;
699
759
sendfile_max_chunk 1M;
700
760
761
761
+
limit_rate $peertube_limit_rate;
701
762
limit_rate_after 5M;
702
702
-
703
703
-
set $peertube_limit_rate 5M;
704
704
-
set $limit_rate $peertube_limit_rate;
705
763
706
764
rewrite ^/static/streaming-playlists/(.*)$ /$1 break;
707
765
'';
708
766
};
709
767
710
710
-
locations."~ ^/static/webseed/" = {
768
768
+
locations."^~ /static/webseed/" = {
711
769
tryFiles = "$uri @api";
712
770
root = cfg.settings.storage.videos;
713
713
-
priority = 1380;
771
771
+
priority = 1460;
714
772
extraConfig = ''
773
773
+
set $peertube_limit_rate 800k;
774
774
+
775
775
+
if ($request_uri ~ -fragmented.mp4$) {
776
776
+
set $peertube_limit_rate 5M;
777
777
+
}
778
778
+
715
779
if ($request_method = 'OPTIONS') {
716
780
${nginxCommonHeaders}
717
781
add_header Access-Control-Max-Age 1728000;
···
729
793
sendfile on;
730
794
sendfile_max_chunk 1M;
731
795
796
796
+
limit_rate $peertube_limit_rate;
732
797
limit_rate_after 5M;
733
733
-
734
734
-
set $peertube_limit_rate 800k;
735
735
-
set $limit_rate $peertube_limit_rate;
736
798
737
799
rewrite ^/static/webseed/(.*)$ /$1 break;
738
800
'';