52 lines
1.8 KiB
Plaintext
52 lines
1.8 KiB
Plaintext
|
|
server {
|
||
|
|
client_max_body_size 0;
|
||
|
|
server_name {{ domain_s3 }};
|
||
|
|
|
||
|
|
location / {
|
||
|
|
proxy_pass http://127.0.0.1:9000; # Proxy to MinIO or your S3-compatible service
|
||
|
|
proxy_set_header Host $http_host; # Essential for S3 bucket operations
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
|
|
||
|
|
# Remove existing cors headers from MinIO to prevent duplicates
|
||
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
||
|
|
|
||
|
|
# CORS Settings
|
||
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
||
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||
|
|
add_header 'Access-Control-Allow-Headers' '*' always;
|
||
|
|
add_header 'Access-Control-Expose-Headers' 'Origin, Content-Type, Content-MD5, Content-Disposition, ETag' always;
|
||
|
|
|
||
|
|
# Handle CORS preflight requests
|
||
|
|
if ($request_method = 'OPTIONS') {
|
||
|
|
add_header 'Content-Length' 0;
|
||
|
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||
|
|
return 204;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
# ACME Challenge Location (for Let's Encrypt)
|
||
|
|
location ^~ /.well-known/acme-challenge/ {
|
||
|
|
alias /var/www/html/.well-known/acme-challenge/;
|
||
|
|
default_type 'text/plain';
|
||
|
|
allow all;
|
||
|
|
}
|
||
|
|
|
||
|
|
listen 443 ssl; # managed by Certbot
|
||
|
|
ssl_certificate /etc/nginx/placeholder.crt; # managed by Certbot
|
||
|
|
ssl_certificate_key /etc/nginx/placeholder.key; # managed by Certbot
|
||
|
|
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
server {
|
||
|
|
|
||
|
|
|
||
|
|
listen 80;
|
||
|
|
server_name {{ domain_s3 }};
|
||
|
|
return 404; # managed by Certbot
|
||
|
|
|
||
|
|
|
||
|
|
}
|