This repository was archived by the owner on Dec 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
47 lines (39 loc) · 1.36 KB
/
nginx.conf
File metadata and controls
47 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
# Logs
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Desactivar logs para favicon
location = /favicon.ico {
log_not_found off;
access_log off;
}
# Desactivar logs para robots.txt
location = /robots.txt {
log_not_found off;
access_log off;
}
# Configuración para archivos estáticos comunes (debe ir primero para mayor prioridad)
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot|json|xml|txt|pdf|map)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# Configuración para cada subdirectorio (ramas/tags)
# Cada directorio se trata como una SPA independiente
location ~ ^/([^/]+)(/|$) {
set $branch_dir $1;
# Primero intentar servir el archivo exacto
# Si no existe, intentar como directorio con index.html
# Si tampoco existe, servir el index.html del directorio raíz de esa rama (para SPAs)
try_files $uri $uri/ /$branch_dir/index.html =404;
}
# Configuración para la raíz - página de redirección
# Esto debe ir al final para que tenga menor prioridad
location = / {
try_files /index.html =404;
}
}