server {
    listen 80 default_server;
    listen [::]:80 default_server;

    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    if ($host != "{{ ansible_fqdn }}") {
        rewrite ^ https://{{ ansible_fqdn }}$request_uri permanent;
    }

    include snippets/snakeoil.conf;

    if ($https != "on") {
        return 301 https://{{ ansible_fqdn }}$request_uri;
    }

    root /var/www/;

    location /munin {
        alias /var/cache/munin/www;
    }
    
    index index.html;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }
}
