-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.conf
40 lines (36 loc) · 1.19 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
server {
listen 80;
server_name localhost;
# Gérer le routage des applications SPA (Single Page Applications)
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
# Serve static files (images, CSS, JS, etc.)
location ~* \.(?:ico|css|js|gif|jpe?g|png|svg)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
root /usr/share/nginx/html;
}
location ~* \.(?:css|js)$ {
expires 1M;
add_header Cache-Control "public";
gzip on; # Activer la compression Gzip
}
# Configuration pour accéder à nginx-ui via /ui
location /ui/ {
proxy_pass http://10.172.16.3:9080/; # Port où tourne nginx-ui
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Gestion des chemins pour éviter les conflits
rewrite ^/ui(/.*)$ $1 break;
}
# Page d'erreur 404 personnalisée
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
}