server {
    listen 80;
    listen [::]:80;
    server_name airsonic.seaturtle.pw;

    return 301 https://airsonic.seaturtle.pw$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name airsonic.seaturtle.pw;

    # ssl conf
    include /config/nginx/ssl.conf;

    # Proxy airsonic
    # https://airsonic.github.io/docs/proxy/nginx/
    location / {
        proxy_set_header X-Real-IP         $remote_addr;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-Host  $http_host;
        proxy_set_header Host              $http_host;
        proxy_max_temp_file_size           0;
        proxy_pass                         http://airsonic:4040;
        proxy_redirect                     http:// https://;
    }
}