2023-07-04 15:39:08 +00:00
|
|
|
events {
|
|
|
|
worker_connections 4096;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2023-07-07 22:46:36 +00:00
|
|
|
# Log format
|
2023-07-07 22:54:21 +00:00
|
|
|
log_format main '[$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
|
2023-07-07 22:49:22 +00:00
|
|
|
|
|
|
|
access_log /dev/stdout main; # Log access to stdout
|
|
|
|
error_log /dev/stdout; # Log errors to stdout
|
2023-07-07 22:44:07 +00:00
|
|
|
|
2023-07-07 22:46:36 +00:00
|
|
|
include mime.types; # Include the mime types file
|
|
|
|
default_type application/octet-stream; # Default type
|
2023-07-04 16:46:31 +00:00
|
|
|
|
2023-07-07 22:46:36 +00:00
|
|
|
sendfile on; # Send files directly from disk
|
|
|
|
keepalive_timeout 15; # Keep connections alive for 15 seconds
|
|
|
|
types_hash_max_size 4096; # Max number of mime types
|
2023-07-04 15:46:10 +00:00
|
|
|
|
2023-07-07 22:46:36 +00:00
|
|
|
# TCP optimizations
|
|
|
|
tcp_nopush on; # Send headers in one packet
|
|
|
|
tcp_nodelay on; # Don't wait for packets to be full
|
|
|
|
|
2023-07-04 16:46:31 +00:00
|
|
|
|
2023-07-07 22:46:36 +00:00
|
|
|
server {
|
|
|
|
server_name _; # Listen on all hostnames
|
|
|
|
listen 80; # Listen on port 80
|
2023-07-04 15:37:53 +00:00
|
|
|
|
2023-07-07 22:46:36 +00:00
|
|
|
root /var/www/html; # Serve files from /var/www/html
|
|
|
|
index index.html index.htm; # Serve index.html and index.htm by default
|
2023-07-07 22:37:39 +00:00
|
|
|
|
|
|
|
# Gzip
|
|
|
|
gzip on;
|
|
|
|
gzip_disable "msie6";
|
|
|
|
gzip_vary on;
|
|
|
|
gzip_proxied any;
|
|
|
|
gzip_comp_level 8;
|
|
|
|
gzip_buffers 16 64k;
|
|
|
|
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
|
2023-07-04 16:56:28 +00:00
|
|
|
client_max_body_size 500M; # Will get replaced by the environment variable MAX_UPLOAD_SIZE
|
2023-07-04 15:37:53 +00:00
|
|
|
|
2023-07-07 22:46:36 +00:00
|
|
|
# Upload endpoint
|
2023-07-04 23:50:30 +00:00
|
|
|
location /upload.php {
|
2023-07-04 15:37:53 +00:00
|
|
|
try_files $uri =404;
|
|
|
|
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
2023-07-04 16:02:32 +00:00
|
|
|
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
|
2023-07-04 15:37:53 +00:00
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
include fastcgi_params;
|
|
|
|
}
|
|
|
|
|
2023-07-07 22:46:36 +00:00
|
|
|
# Serve your files
|
|
|
|
location / {
|
2023-07-04 15:37:53 +00:00
|
|
|
expires 7d;
|
|
|
|
|
2023-07-07 22:37:39 +00:00
|
|
|
open_file_cache max=1000 inactive=60s;
|
|
|
|
open_file_cache_valid 60s;
|
|
|
|
open_file_cache_min_uses 1;
|
|
|
|
open_file_cache_errors on;
|
|
|
|
|
2023-07-04 15:37:53 +00:00
|
|
|
# Serve the file directly from disk
|
2023-07-05 00:01:54 +00:00
|
|
|
try_files $uri $uri/ =404;
|
2023-07-04 15:37:53 +00:00
|
|
|
}
|
2023-07-07 22:41:23 +00:00
|
|
|
}
|
2023-07-04 15:37:53 +00:00
|
|
|
}
|