- server {
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
-
- {% if nginx_proxy_protocol %}
- # Alternate Port for PROXY PROTOCOL incoming connections
- listen 10443 ssl http2 proxy_protocol;
- listen [::]:10443 ssl http2 proxy_protocol;
-
- # RealIP rewrite authorized for connection from reverse-proxy
- set_real_ip_from {{ hostvars | ip_from_inventory('vm_gateway') }};
- real_ip_header proxy_protocol;
- {% endif %}
-
- server_name {{ nginx_site_fqdn }} {{ nginx_site_alternate_fqdns | join(' ') }};
-
- # Do not advertise nginx version number
- server_tokens off;
-
- # Certificates location from CertBot
- ssl_certificate /etc/letsencrypt/live/{{ nginx_site_fqdn }}/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/{{ nginx_site_fqdn }}/privkey.pem;
-
- # TLS Mozilla Guideline v5.4,
- # nginx 1.14.2, OpenSSL 1.1.1d, modern configuration
- ssl_session_timeout 1d;
- ssl_session_cache shared:MozSSL:10m;
- ssl_session_tickets off;
- # modern configuration
- ssl_protocols TLSv1.3 {{ 'TLSv1.2' if nginx_tls_1_2 }};
- {% if nginx_tls_1_2 %}
- ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
- {% endif %}
- ssl_prefer_server_ciphers off;
- # HSTS (2 years, no preloading)
- add_header Strict-Transport-Security "max-age=63072000" always;
- # OCSP stapling
- ssl_stapling on;
- ssl_stapling_verify on;
-
- # verify chain of trust of OCSP response using Root CA and Intermediate certs
- ssl_trusted_certificate /etc/letsencrypt/live/{{ nginx_site_fqdn }}/chain.pem;
-
- # Include custom locations
- include /etc/nginx/locations/{{ nginx_site_fqdn }}/*.conf;
- }
|