server { listen 80; server_name localhost; root /var/www/html/public; index index.php index.html; # Logging access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # Charset charset utf-8; # Aumentar tamaño máximo de archivos client_max_body_size 20M; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } # Denegar acceso a archivos ocultos location ~ /\. { deny all; access_log off; log_not_found off; } # PHP-FPM Configuration location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass app:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PHP_VALUE "upload_max_filesize=20M \n post_max_size=20M"; fastcgi_buffering off; fastcgi_read_timeout 300; } # Cache de archivos estáticos location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # Denegar acceso a archivos Laravel sensibles location ~ /\.(?!well-known).* { deny all; } }