From 4aec8e87f612e54734794a9c8e80ae3fdf3a3a85 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Tue, 5 May 2026 21:26:59 +0200 Subject: [PATCH] Remove verbose comments in nginx config --- nginx_config.example | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/nginx_config.example b/nginx_config.example index 21abf0b..a798fb0 100644 --- a/nginx_config.example +++ b/nginx_config.example @@ -1,11 +1,3 @@ -#map $sent_http_content_type $expires { -# default off; -## image/png off; -# application/javascript epoch; -# text/html epoch; -# text/css epoch; -#} - #https://www.nginx.com/blog/websocket-nginx/ map $http_upgrade $connection_upgrade { default upgrade; @@ -14,48 +6,41 @@ map $http_upgrade $connection_upgrade { server { listen *:80; - listen [::]:80; #ipv6only=off; + listen [::]:80; server_name my.server.com www.my.server.com; return 301 https://my.server.com$request_uri; } server { listen 443 ssl; - listen [::]:443 ssl; #http2 ipv6only=off; + listen [::]:443 ssl; http2 on; server_name my.server.com; - - # On pointe sur le dossier généré par ton script root /path/to/xogo/dist; error_log /var/log/nginx/xogo_error.log; access_log /var/log/nginx/xogo_access.log; - # 1. Le point d'entrée : TOUJOURS vérifier s'il y a une mise à jour + # 1. Entry point: always check if there was an update location = /index.html { add_header Cache-Control "no-cache, must-revalidate"; expires 0; } - # 2. Les fichiers statiques hashés (JS, CSS) + Assets - # Ils ont un hash dans le nom, donc s'ils changent, l'URL change. - # On peut les cacher de façon agressive. + # 2. Static hashed files (JS, CSS) + assets: agressive caching location / { try_files $uri $uri/ /index.html; expires 1y; add_header Cache-Control "public, immutable"; } - # 3. WebSocket : Pas de changement ici, c'est parfait + # 3. WebSocket server proxy location /ws { proxy_pass http://localhost:WS_PORT; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; - #proxy_set_header Connection "Upgrade"; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; - - # Le cache n'a pas de sens pour un tunnel WebSocket proxy_buffering off; } -- 2.53.0