server {
    server_name news.example.com;
    listen 80; # adding HTTPS configuration is highly recommended
    # redirect to HTTPS, if desired
    #if ($https != "on") {rewrite ^ https://$host$request_uri;}
    # the userPreAuth setting should be enabled if the Web server is handling authentication
    #auth_basic "Advanced RSS Environment";
    root /usr/share/arsse/www;
    index index.html;
    
    location / {
        try_files $uri $uri/ =404;
    }

    location @arsse_auth {
        # the userPreAuth setting should be enabled if the Web server is handling authentication
        #auth_basic "Advanced RSS Environment";
        include /usr/share/arsse/dist/nginx-fcgi.conf;
    }

    location @arsse_no_auth {
        auth_basic off;
        include /usr/share/arsse/dist/nginx-fcgi.conf;
    }
    
    # NextCloud News protocol
    location /index.php/apps/news/api {
        try_files $uri @arsse_auth;
        
        location ~ ^/index\.php/apps/news/api/?$ {
            try_files $uri @arsse_no_auth;
        }
    }

    # Tiny Tiny RSS protocol
    location /tt-rss/api {
        try_files $uri @arsse_no_auth;
    }

    # Tiny Tiny RSS feed icons
    location /tt-rss/feed-icons/ {
        try_files $uri @arsse_no_auth;
    }

    # Tiny Tiny RSS special-feed icons
    location /tt-rss/images/ {
        root /usr/share/arsse/www;
        try_files $uri =404;
    }
}