|
1 | 1 | server { |
2 | | - # Render provisions and terminates SSL |
3 | | - listen 80; |
| 2 | + # Render provisions and terminates SSL |
| 3 | + listen 80; |
4 | 4 |
|
5 | | - # Make site accessible from http://localhost/ |
6 | | - server_name _; |
| 5 | + # Configuración del nombre del servidor |
| 6 | + # Puedes reemplazar "_" con tu dominio si está disponible |
| 7 | + server_name _; |
7 | 8 |
|
8 | | - root /var/www/html/public; |
9 | | - index index.html index.htm index.php; |
| 9 | + # Directorio raíz donde se encuentra Laravel |
| 10 | + root /var/www/html/public; |
| 11 | + index index.php index.html index.htm; |
10 | 12 |
|
11 | | - # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html |
12 | | - sendfile off; |
| 13 | + # Deshabilitar "sendfile" debido a problemas con sistemas de archivos compartidos |
| 14 | + sendfile off; |
13 | 15 |
|
14 | | - # Add stdout logging |
15 | | - error_log /dev/stdout info; |
16 | | - access_log /dev/stdout; |
| 16 | + # Logs en la salida estándar para entornos Docker/Render |
| 17 | + error_log /dev/stdout info; |
| 18 | + access_log /dev/stdout; |
17 | 19 |
|
18 | | - # block access to sensitive information about git |
19 | | - location /.git { |
20 | | - deny all; |
21 | | - return 403; |
22 | | - } |
| 20 | + # Bloquear acceso a información sensible del repositorio .git |
| 21 | + location /.git { |
| 22 | + deny all; |
| 23 | + return 403; |
| 24 | + } |
23 | 25 |
|
24 | | - add_header X-Frame-Options "SAMEORIGIN"; |
25 | | - add_header X-XSS-Protection "1; mode=block"; |
26 | | - add_header X-Content-Type-Options "nosniff"; |
| 26 | + # Encabezados de seguridad |
| 27 | + add_header X-Frame-Options "SAMEORIGIN"; |
| 28 | + add_header X-XSS-Protection "1; mode=block"; |
| 29 | + add_header X-Content-Type-Options "nosniff"; |
27 | 30 |
|
28 | | - charset utf-8; |
| 31 | + # Configuración de codificación de caracteres |
| 32 | + charset utf-8; |
29 | 33 |
|
30 | | - location / { |
31 | | - try_files $uri $uri/ /index.php?$query_string; |
32 | | - } |
| 34 | + # Manejo de rutas principales |
| 35 | + location / { |
| 36 | + # Intentar servir el archivo solicitado, luego redirigir a index.php |
| 37 | + try_files $uri $uri/ /index.php?$query_string; |
| 38 | + } |
33 | 39 |
|
34 | | - location = /favicon.ico { access_log off; log_not_found off; } |
35 | | - location = /robots.txt { access_log off; log_not_found off; } |
| 40 | + # Configuración para favicon y robots.txt (silencia logs) |
| 41 | + location = /favicon.ico { access_log off; log_not_found off; } |
| 42 | + location = /robots.txt { access_log off; log_not_found off; } |
36 | 43 |
|
37 | | - error_page 404 /index.php; |
| 44 | + # Página de error personalizada para 404 (redirige a index.php) |
| 45 | + error_page 404 /index.php; |
38 | 46 |
|
39 | | - location ~* \.(jpg|jpeg|gif|png|css|js|ico|webp|tiff|ttf|svg)$ { |
40 | | - expires 5d; |
41 | | - } |
| 47 | + # Configuración de caché para archivos estáticos (imágenes, CSS, JS, etc.) |
| 48 | + location ~* \.(jpg|jpeg|gif|png|css|js|ico|webp|tiff|ttf|svg|woff|woff2|eot|otf)$ { |
| 49 | + expires 5d; # Establece la expiración en 5 días |
| 50 | + access_log off; # Silencia los logs de acceso para estos archivos |
| 51 | + } |
42 | 52 |
|
43 | | - location ~ \.php$ { |
44 | | - fastcgi_split_path_info ^(.+\.php)(/.+)$; |
45 | | - fastcgi_pass unix:/var/run/php-fpm.sock; |
46 | | - fastcgi_index index.php; |
47 | | - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
48 | | - fastcgi_param SCRIPT_NAME $fastcgi_script_name; |
49 | | - include fastcgi_params; |
50 | | - } |
| 53 | + # Manejo de archivos PHP |
| 54 | + location ~ \.php$ { |
| 55 | + include fastcgi_params; # Incluir parámetros estándar de FastCGI |
| 56 | + fastcgi_split_path_info ^(.+\.php)(/.+)$; # Separar el script y la información del path |
| 57 | + fastcgi_pass unix:/var/run/php-fpm.sock; # Conectar a PHP-FPM usando un socket Unix |
| 58 | + fastcgi_index index.php; # Archivo predeterminado para solicitudes PHP |
| 59 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Ruta completa al script PHP |
| 60 | + fastcgi_param SCRIPT_NAME $fastcgi_script_name; |
| 61 | + } |
51 | 62 |
|
52 | | - # deny access to . files |
53 | | - location ~ /\. { |
54 | | - log_not_found off; |
55 | | - deny all; |
56 | | - } |
| 63 | + # Bloquear acceso a archivos sensibles y directorios ocultos |
| 64 | + location ~ /\. { |
| 65 | + log_not_found off; # Silenciar logs si el archivo no existe |
| 66 | + deny all; # Denegar acceso |
| 67 | + } |
57 | 68 |
|
58 | | - location ~ /\.(?!well-known).* { |
59 | | - deny all; |
60 | | - } |
| 69 | + # Proteger otros archivos ocultos excepto .well-known (necesario para SSL) |
| 70 | + location ~ /\.(?!well-known).* { |
| 71 | + deny all; |
| 72 | + } |
61 | 73 | } |
0 commit comments