{ ... }:

let
  bensIp = "73.222.221.62";
in
{
  services = {
    nginx = {
      enable = true;
      recommendedGzipSettings = true;
      recommendedOptimisation = true;
      recommendedProxySettings = true;
      recommendedTlsSettings = true;
      virtualHosts = {
        "bsima.me".root = "/home/ben/public_html/";
        "www.bsima.me".root = "/home/ben/public_html/";
        "simatime.com".locations."/".root = "/srv/www/";
        "firefoxsync.simatime.com".locations."/".proxyPass = "http://localhost:5001";
        "hero.simatime.com".locations."/".proxyPass = "http://${bensIp}:3001";
        "tv.simatime.com".locations."/".proxyPass = "http://${bensIp}:8096"; # emby runs on port 8096
        "deluge.simatime.com".locations."/".proxyPass = "http://${bensIp}:8112";

        "notebook.simatime.com".locations = {
          "/" = {
            proxyPass = "http://${bensIp}:3099";
            proxyWebsockets = true;
            extraConfig = ''
              proxy_buffering off;
              proxy_read_timeout 86400;

            '';
          };
          "/(api/kernels/[^/]+/channels|terminals/websocket)/" = {
            proxyPass = "http://${bensIp}:3099";
            proxyWebsockets = true;
          };
        };
      };
    };
  };
}