server { listen 80 default_server; listen 443 ssl default_server; server_name ansible.http.tests _; ssl_certificate /root/ca/ansible.http.tests-cert.pem; ssl_certificate_key /root/ca/private/ansible.http.tests-key.pem; location =/cacert.pem { alias /usr/share/nginx/html/cacert.pem; } location / { proxy_pass http://127.0.0.1:8000; } } server { listen 80; listen 443 ssl; server_name sni1.ansible.http.tests; ssl_certificate /root/ca/sni1.ansible.http.tests-cert.pem; ssl_certificate_key /root/ca/private/sni1.ansible.http.tests-key.pem; location / { return 200 "sni1.ansible.http.tests"; } } server { listen 80; listen 443 ssl; server_name sni2.ansible.http.tests; ssl_certificate /root/ca/sni2.ansible.http.tests-cert.pem; ssl_certificate_key /root/ca/private/sni2.ansible.http.tests-key.pem; location / { return 200 "sni2.ansible.http.tests"; } } server { listen 80; server_name fail.ansible.http.tests; rewrite /(.*) https://$host/$1 permanent; }