1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00

Update nginx.conf

This commit is contained in:
ericgaspar 2023-12-31 10:35:13 +01:00
parent f377bdbd73
commit 019ed06cbd

View file

@ -19,19 +19,19 @@ location @api {
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
} }
location = /api/v1/videos/upload-resumable {
client_max_body_size 0;
proxy_request_buffering off;
try_files /dev/null @api;
}
location / { location / {
try_files /dev/null @api; try_files /dev/null @api;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }
location ~ ^/api/v1/videos/(upload-resumable|([^/]+/source/replace-resumable))$ {
client_max_body_size 0;
proxy_request_buffering off;
try_files /dev/null @api;
}
location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ { location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ {
limit_except POST HEAD { deny all; } limit_except POST HEAD { deny all; }
@ -98,10 +98,9 @@ location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ {
root __DATA_DIR__/storage/; root __DATA_DIR__/storage/;
# Enable compression for JS/CSS/HTML, for improved client load times. # Enable compression for JS/CSS/HTML, for improved client load times.
# It might be nice to compress JSON/XML as returned by the API, but # It might be nice to compress JSON/XML as returned by the API, but
# leaving that out to protect against potential BREACH attack. # leaving that out to protect against potential BREACH attack.
# gzip on; # gzip on;
gzip_vary on; gzip_vary on;
gzip_types # text/html is always compressed by HttpGzipModule gzip_types # text/html is always compressed by HttpGzipModule
@ -145,30 +144,6 @@ location ~ ^/client/(.*\.(js|css|png|svg|woff2|otf|ttf|woff|eot))$ {
alias __INSTALL_DIR__/client/dist/$1; alias __INSTALL_DIR__/client/dist/$1;
} }
# Bypass PeerTube for performance reasons. Optional.
location ~ ^/static/(thumbnails|avatars)/ {
if ($request_method = 'OPTIONS') {
more_set_headers "Access-Control-Allow-Origin : *";
more_set_headers "Access-Control-Allow-Methods : GET, OPTIONS";
more_set_headers "Access-Control-Allow-Headers : Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type";
more_set_headers "Access-Control-Max-Age : 1728000"; # Preflight request can be cached 20 days
more_set_headers "Content-Type : text/plain charset=UTF-8";
more_set_headers "Content-Length : 0";
return 204;
}
more_set_headers "Access-Control-Allow-Origin : *";
more_set_headers "Access-Control-Allow-Methods : GET, OPTIONS";
more_set_headers "Access-Control-Allow-Headers : Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type";
more_set_headers "Cache-Control : public, max-age=7200"; # Cache response 2 hours
rewrite ^/static/(.*)$ /$1 break;
root __DATA_DIR__/storage/;
try_files $uri @api;
}
location ~ ^(/static/(webseed|web-videos|streaming-playlists)/private/)|^/download { location ~ ^(/static/(webseed|web-videos|streaming-playlists)/private/)|^/download {
# We can't rate limit a try_files directive, so we need to duplicate @api # We can't rate limit a try_files directive, so we need to duplicate @api