156 lines
3.8 KiB
Plaintext
156 lines
3.8 KiB
Plaintext
daemon off;
|
|
error_log /dev/stderr;
|
|
user nobody nobody;
|
|
|
|
events {}
|
|
|
|
http {
|
|
##
|
|
# Basic Settings
|
|
##
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
types_hash_max_size 2048;
|
|
client_body_temp_path /tmp/nginx-cache-client 1 2;
|
|
proxy_temp_path /tmp/nginx-cache-proxy 1 2;
|
|
|
|
#
|
|
# SSL Settings
|
|
##
|
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
##
|
|
# Gzip Settings
|
|
##
|
|
gzip on;
|
|
|
|
access_log /dev/stdout;
|
|
server_names_hash_bucket_size 64;
|
|
|
|
upstream backend {
|
|
server 127.0.0.1:9000;
|
|
}
|
|
|
|
server {
|
|
# In production you should use TLS instead of plain HTTP
|
|
listen [::]:443 http2 ssl;
|
|
|
|
# should be the endpoint you want
|
|
# aws uses s3.amazonaws.com for example
|
|
server_name garage.example.com;
|
|
|
|
location / {
|
|
proxy_pass http://s3_backend;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $host;
|
|
}
|
|
}
|
|
|
|
|
|
server {
|
|
listen [::]:80;
|
|
|
|
server_name peertube.localhost;
|
|
|
|
##
|
|
# Application
|
|
##
|
|
|
|
location @api {
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
client_max_body_size 100k; # default is 1M
|
|
|
|
proxy_connect_timeout 10m;
|
|
proxy_send_timeout 10m;
|
|
proxy_read_timeout 10m;
|
|
send_timeout 10m;
|
|
|
|
proxy_pass http://backend;
|
|
}
|
|
|
|
location / {
|
|
try_files /dev/null @api;
|
|
}
|
|
|
|
location = /api/v1/videos/upload-resumable {
|
|
client_max_body_size 0;
|
|
proxy_request_buffering off;
|
|
|
|
try_files /dev/null @api;
|
|
}
|
|
|
|
location = /api/v1/videos/upload {
|
|
limit_except POST HEAD { deny all; }
|
|
|
|
# This is the maximum upload size, which roughly matches the maximum size of a video file.
|
|
# Note that temporary space is needed equal to the total size of all concurrent uploads.
|
|
# This data gets stored in /var/lib/nginx by default, so you may want to put this directory
|
|
# on a dedicated filesystem.
|
|
client_max_body_size 12G; # default is 1M
|
|
add_header X-File-Maximum-Size 8G always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
|
|
|
try_files /dev/null @api;
|
|
}
|
|
|
|
location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) {
|
|
client_max_body_size 6M; # default is 1M
|
|
add_header X-File-Maximum-Size 4M always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
|
|
|
try_files /dev/null @api;
|
|
}
|
|
|
|
##
|
|
# Websocket
|
|
##
|
|
|
|
location @api_websocket {
|
|
proxy_http_version 1.1;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_pass http://backend;
|
|
}
|
|
|
|
location /socket.io {
|
|
try_files /dev/null @api_websocket;
|
|
}
|
|
|
|
location /tracker/socket {
|
|
# Peers send a message to the tracker every 15 minutes
|
|
# Don't close the websocket before then
|
|
proxy_read_timeout 15m; # default is 60s
|
|
|
|
try_files /dev/null @api_websocket;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen [::]:80;
|
|
|
|
server_name peertube-video.garage.localhost peertube-playlist.garage.localhost;
|
|
|
|
|
|
location / {
|
|
add_header Access-Control-Allow-Origin *;
|
|
add_header Access-Control-Max-Age 3600;
|
|
add_header Access-Control-Expose-Headers Content-Length;
|
|
add_header Access-Control-Allow-Headers Range;
|
|
if ($request_method !~ ^(GET|HEAD)$ ) {
|
|
return 200;
|
|
}
|
|
proxy_pass http://127.0.0.1:3902;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $host;
|
|
}
|
|
}
|
|
}
|