-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
56 lines (48 loc) · 1.42 KB
/
nginx.conf
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
48
49
50
51
52
53
54
55
56
server {
listen 80;
server_name sebagarcia.dev;
root /usr/share/nginx/html;
index index.html;
# Configuración básica de seguridad
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;
# Ruta principal
location / {
try_files $uri $uri/ /index.html;
}
# Manejo de archivos estáticos
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
try_files $uri =404;
access_log off;
log_not_found off;
}
# Favicon.ico
location = /favicon.ico {
log_not_found off;
access_log off;
}
# Robots.txt
location = /robots.txt {
log_not_found off;
access_log off;
}
# Denegar acceso a archivos ocultos
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Configuración de gzip
gzip on;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript;
gzip_disable "MSIE [1-6]\.";
# Manejar errores 404
error_page 404 /index.html;
}