Start upload functionality

This commit is contained in:
Your Name
2025-08-19 08:00:40 -04:00
parent e8bac95aca
commit d8803b1ad0
16 changed files with 2386 additions and 42 deletions

View File

@@ -18,8 +18,8 @@ http {
keepalive_timeout 65;
types_hash_max_size 2048;
# MIME types
include /etc/nginx/mime.types;
# MIME types (local)
include mime.types;
default_type application/octet-stream;
# Logging (relative to prefix directory)
@@ -58,9 +58,8 @@ http {
}
# GET requests served directly with explicit file extensions
# try_files /$1 =404;
# try_files /$1.webp =404;
try_files /$1.pdf /$1.jpg /$1.jpeg /$1.png /$1.webp /$1.gif /$1.mp4 /$1.mp3 =404;
# Potentially in the future look at a LUA extension
try_files /$1.jpg /$1.jpeg /$1.png /$1.webp /$1.gif /$1.pdf /$1.mp4 /$1.mp3 /$1.txt /$1.md=404;
# Set appropriate headers for blobs
add_header Cache-Control "public, max-age=31536000, immutable";
@@ -68,33 +67,7 @@ http {
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
}
# Commented out problematic regex for reference
# location ~ "^/([a-f0-9]{64}).*$" {
# limit_except HEAD GET {
# deny all;
# }
#
# # Debug headers to see what nginx is capturing
# add_header X-Debug-Hash "$1" always;
# add_header X-Debug-TryFiles "$1*" always;
# add_header X-Debug-URI "$uri" always;
# add_header X-Debug-Root "$document_root" always;
#
# # Route HEAD requests to FastCGI via rewrite
# if ($request_method = HEAD) {
# rewrite ^/(.*)$ /fcgi-head/$1 last;
# }
#
# # GET requests served directly with hash-only lookup
# try_files $1* =404;
#
# # Set appropriate headers for blobs
# add_header Cache-Control "public, max-age=31536000, immutable";
# add_header X-Content-Type-Options nosniff;
# add_header X-Frame-Options DENY;
# add_header X-XSS-Protection "1; mode=block";
# }
# FastCGI handler for HEAD requests
location ~ "^/fcgi-head/([a-f0-9]{64}).*$" {
@@ -116,6 +89,19 @@ http {
}
# Upload endpoint - requires authentication
location /upload {
# Pass to FastCGI application for processing
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/ginxsom.fcgi;
fastcgi_pass fastcgi_backend;
# Only allow PUT method for uploads
if ($request_method !~ ^(PUT)$ ) {
return 405;
}
}
# Health check endpoint
location /health {
access_log off;