worker_processes  1;

events {
  worker_connections  512;
}

http {
  server {
    listen 80;

    root   /usr/share/nginx/html/;
    index  index.html;

    location / {
      try_files $uri /index.html index.php;
    } 
    
    ### SSL LetsEncrypt
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;

    ssl_certificate /etc/letsencrypt/live/jimsgarage.co.uk/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/jimsgarage.co.uk/privkey.pem;

    ### Create the dhparam file: 
    ### openssl  dhparam  -out  ssl-dhparams.pem  4096
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:1m;  # about 4000 sessions
    ssl_session_tickets off;

    # intermediate configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    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;
    ssl_prefer_server_ciphers off;

    # HSTS (ngx_http_headers_module is required) (63072000 seconds)
    add_header Strict-Transport-Security "max-age=63072000" always;
  }

    server {
    listen 80;
  
    server_name it-tools.jimsgarage.co.uk;

    location / {
      proxy_pass http://it-tools;
    } 
    
    ### SSL LetsEncrypt
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;

    ssl_certificate /etc/letsencrypt/live/jimsgarage.co.uk/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/jimsgarage.co.uk/privkey.pem;

    ### Create the dhparam file: 
    ### openssl  dhparam  -out  ssl-dhparams.pem  4096
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:1m;  # about 4000 sessions
    ssl_session_tickets off;

    # intermediate configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    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;
    ssl_prefer_server_ciphers off;

    # HSTS (ngx_http_headers_module is required) (63072000 seconds)
    add_header Strict-Transport-Security "max-age=63072000" always;
  }
}