# =============================================================================
# Nginx Configuration for Gentoo Binhost
# =============================================================================
# Optimisé pour servir des packages binaires Gentoo
# À copier vers: /docker/web/appdata/binhost/nginx.conf
# =============================================================================
server {
listen 80;
server_name binpkg.xenonet.cc;
root /usr/share/nginx/html;
# Logging
access_log /var/log/nginx/binhost-access.log;
error_log /var/log/nginx/binhost-error.log;
# Page d'index pour /packages/
location /packages/ {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
autoindex_format html;
# Injection CSS Monokai Dark pour autoindex
sub_filter '' '';
sub_filter_once on;
sub_filter_types text/html;
# Cache headers pour les binaires (no .asc — signatures are internal per GLEP 78)
location ~* \.(gpkg\.tar|tbz2)$ {
add_header Cache-Control "public, max-age=86400";
add_header X-Content-Type-Options "nosniff";
}
# Fichiers d'index Portage
location ~* (Packages|Packages\.gz|Packages\.xz)$ {
add_header Cache-Control "public, max-age=300";
}
}
# Clés GPG publiques
location /gpg/ {
autoindex on;
# Injection CSS Monokai Dark pour autoindex
sub_filter '' '';
sub_filter_once on;
sub_filter_types text/html;
# Appliquer le Content-Type uniquement aux fichiers .asc
location ~* \.asc$ {
add_header Content-Type "application/pgp-keys";
}
}
# Page d'accueil informative - Materia Dark + Monokai
location = / {
index index.html;
try_files /index.html =404;
}
# Static assets (favicon, logo, etc.)
location ~* ^/(favicon\.(png|ico)|gentoo-logo\.svg)$ {
access_log off;
add_header Cache-Control "public, max-age=604800";
try_files $uri =404;
}
# Health check endpoint
location = /health {
access_log off;
return 200 "OK\n";
add_header Content-Type text/plain;
}
# Default fallback for root-level files
location / {
try_files $uri $uri/ =404;
}
}