upstream backendrtorrent {
    server unix:/run/php/.rtorrent.sock;
}

server {
    listen 80 default_server;

    listen 443 ssl;

    root /app/rutorrent;
    index index.php index.html index.htm;

    server_name _;

    ssl_certificate /config/keys/cert.crt;
    ssl_certificate_key /config/keys/cert.key;

    client_max_body_size 0;

    location / {
        location ~ .php$ {
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include /etc/nginx/fastcgi_params;
        }
    }

    location /RPC2 {
        access_log /config/log/nginx/rutorrent.rpc2.access.log;
        error_log /config/log/nginx/rutorrent.rpc2.error.log;
        include /etc/nginx/scgi_params;
        scgi_pass backendrtorrent;
    }
}
