nginx-configs/conf.d/cdn.conf

104 lines
2.9 KiB
Plaintext
Raw Permalink Normal View History

2023-04-13 18:37:55 +00:00
server {
if ($host ~ ^[^.]+\.fascinated\.cc$) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name cdn.fascinated.cc;
return 301 https://$host$request_uri;
}
server {
server_name cdn.fascinated.cc;
# Enable QUIC and HTTP/3.
listen 443 quic;
# Enable HTTP/2 (optional).
listen 443 ssl http2;
add_header alt-svc 'h3-23=":443"; ma=86400';
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 8;
gzip_buffers 16 64k;
gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
root /home/fascinated-cdn/;
index index.html index.htm;
client_max_body_size 500M;
client_body_buffer_size 500M; # Set the buffer size limit to 100MB or any desired size.
# Set the timeouts as per your requirements
client_body_timeout 120s;
client_header_timeout 120s;
send_timeout 120s;
# TCP optimizations
tcp_nopush on;
tcp_nodelay on;
# file shit
sendfile on;
sendfile_max_chunk 1m;
aio on;
directio 512;
# Keep connections alive for 15 seconds
keepalive_timeout 15;
# SSL Configuration - Replace the example <domain> with your domain
ssl_certificate /etc/letsencrypt/live/fascinated.cc/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/fascinated.cc/privkey.pem; # managed by Certbot
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1h;
# Certbot (might not be needed? idk)
location /.well-known {
root /home/nginx/.well-known;
try_files $uri $uri/;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
location / {
expires 7d;
etag on;
open_file_cache max=1000 inactive=60s;
open_file_cache_valid 60s;
open_file_cache_min_uses 1;
open_file_cache_errors on;
# Serve the file directly from disk
try_files $uri $uri/ /fourohfour.html;
}
error_page 404 /fourohfour.html;
location = /fourohfour.html {
internal;
}
}