tech:notes_nginx
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_nginx [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_nginx [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes nginx | ||
| + | |||
| + | PKI, certificat client : http:// | ||
| + | |||
| + | ~~~nginx | ||
| + | location / | ||
| + | stub_status on; | ||
| + | access_log off; | ||
| + | allow 127.0.0.1; | ||
| + | deny all; | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | location /download { | ||
| + | autoindex on; | ||
| + | charset utf-8; | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | HTTPS | ||
| + | ~~~bash | ||
| + | #cat your_domain_name.crt DigiCertCA.crt >> bundle.crt | ||
| + | #cat keys/ | ||
| + | cat keys/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Reverse Proxy | ||
| + | |||
| + | Voir https:// | ||
| + | |||
| + | `/ | ||
| + | ~~~nginx | ||
| + | server { | ||
| + | server_tokens off; | ||
| + | listen 80; | ||
| + | server_name www.plop.acme.fr plop.acme.fr; | ||
| + | rewrite ^ https:// | ||
| + | } | ||
| + | |||
| + | server { | ||
| + | server_tokens off; | ||
| + | listen 443 ssl; | ||
| + | server_name www.plop.acme.fr plop.acme.fr; | ||
| + | |||
| + | ssl_certificate / | ||
| + | ssl_certificate_key / | ||
| + | add_header Strict-Transport-Security " | ||
| + | |||
| + | access_log / | ||
| + | error_log / | ||
| + | |||
| + | # | ||
| + | # | ||
| + | |||
| + | location / { | ||
| + | include / | ||
| + | proxy_pass http:// | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | |||
| + | } | ||
| + | |||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Pb | ||
| + | |||
| + | ### client intended to send too large body | ||
| + | |||
| + | ~~~ | ||
| + | client_max_body_size 20M; | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | service nginx reload | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autres | ||
| + | |||
| + | Nginx letsencrypt | ||
| + | ~~~ | ||
| + | |||
| + | letsencrypt-auto certonly --standalone --email nospam@acme.fr -d acme.fr -d mail.acme.fr | ||
| + | |||
| + | letsencrypt --config-dir=~/ | ||
| + | letsencrypt --config-dir=$HOME/ | ||
| + | |||
| + | |||
| + | localtion ~ / | ||
| + | |||
| + | location ~ /\. { deny all; } | ||
| + | |||
| + | localtion / { | ||
| + | return 301 https:// | ||
| + | } | ||
| + | |||
| + | |||
| + | listen [::]:443 ssl http2 ipv6only=on; | ||
| + | listen 443 ssl http2; | ||
| + | |||
| + | |||
| + | ssl_certificate / | ||
| + | ssl_certificate_key / | ||
| + | |||
| + | ssl_stapling on; | ||
| + | ssl_stapling_verify on; | ||
| + | ssl_trusted_certificate / | ||
| + | |||
| + | resolver 8.8.8.8 8.8.4.4 valid=300s; | ||
| + | resolver_timeout 3s; | ||
| + | |||
| + | ssl_session_cache shared: | ||
| + | ssl_session_timeout 24h; | ||
| + | ssl_session_tockets on; | ||
| + | ssl_session_ticket_key / | ||
| + | |||
| + | ssl_protocols TLSv1.2; | ||
| + | ssl_ciphers AES256+EECDH: | ||
| + | ssl_dhparam / | ||
| + | https:// | ||
| + | |||
| + | |||
| + | openssl rand 48 -out / | ||
| + | openssl dhparam -out / | ||
| + | |||
| + | letsencrypt renew | ||
| + | |||
| + | mkdir / | ||
| + | --rsa-key-size 4096 --webroot-path / | ||
| + | |||
| + | sudo cerboot --nginx -d belaris.fr -d www.belaris.fr | ||
| + | |||
| + | cp / | ||
| + | |||
| + | |||
| + | https:// | ||
| + | https:// | ||
| + | ~~~ | ||
| + | |||
