# SPDX-FileCopyrightText: 2026 Progmasoft # SPDX-License-Identifier: AGPL-3.0-or-later # https://rustreg.progmasoft.com: Progmasoft's Cargo registry. Cargo reads the # sparse index under /index/ and downloads crates from /crates/; both are # files in /srv/rustreg. Nothing here writes: crates are published over SSH by # ops/rustreg/publish-crate.py. Installed as /etc/nginx/conf.d/rustreg.conf. server { listen 80; listen [::]:80; server_name rustreg.progmasoft.com; server_tokens off; location ^~ /.well-known/acme-challenge/ { root /var/lib/letsencrypt; default_type text/plain; } location / { return 308 https://rustreg.progmasoft.com$request_uri; } } server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name rustreg.progmasoft.com; server_tokens off; ssl_certificate /etc/letsencrypt/live/progmasoft.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/progmasoft.com/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; root /srv/rustreg; autoindex off; client_max_body_size 1k; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Robots-Tag "noindex" always; # The index changes with every publication: Cargo asks again each time. location ^~ /index/ { limit_except GET { deny all; } default_type text/plain; charset utf-8; types { application/json json; } add_header Cache-Control "no-cache" always; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Robots-Tag "noindex" always; try_files $uri =404; } # A published crate never changes; a change is a new version. location ~ "^/crates/[a-z0-9_-]+/[a-z0-9_-]+-[0-9A-Za-z.+-]+\.crate$" { limit_except GET { deny all; } types { } default_type application/octet-stream; expires 1y; add_header Cache-Control "public, immutable" always; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Robots-Tag "noindex" always; try_files $uri =404; } location / { return 404; } }