69 lines
1.8 KiB
Plaintext
69 lines
1.8 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /var/www/html/public;
|
|
index index.php index.html;
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
|
|
|
|
# Handle large file uploads
|
|
client_max_body_size 1024M;
|
|
client_body_timeout 120s;
|
|
fastcgi_read_timeout 300s;
|
|
|
|
# Serve static files
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf|txt|tar|gz)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Handle Laravel routes
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
# PHP-FPM Configuration
|
|
location ~ \.php$ {
|
|
fastcgi_pass 127.0.0.1:9000;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
|
|
# Increase timeouts for large uploads
|
|
fastcgi_read_timeout 300s;
|
|
fastcgi_send_timeout 300s;
|
|
fastcgi_connect_timeout 300s;
|
|
fastcgi_buffer_size 128k;
|
|
fastcgi_buffers 4 256k;
|
|
fastcgi_busy_buffers_size 256k;
|
|
}
|
|
|
|
# Deny access to hidden files
|
|
location ~ /\. {
|
|
deny all;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
access_log off;
|
|
return 200 "healthy\n";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
|
|
# Block access to sensitive files
|
|
location ~* \.(env|log|ini)$ {
|
|
deny all;
|
|
}
|
|
|
|
# Block access to vendor directory
|
|
location ~ /vendor/ {
|
|
deny all;
|
|
}
|
|
}
|