httpd.conf.swtx.template

# SwiggyTix httpd configuration, v 1.0 2023/07/27
# Configuration file for httpd hosting SwiggyTix.
# SwiggyTix runs as a FastCGI service on port 5000

int_ip="127.0.0.1"
ext_ip="__EXT_IP__"

server "__HOSTNAME__" {
        listen on $ext_ip port 80
        location "/.well-known/acme-challenge/*" {
                root "/acme"
                request strip 2
        }
        location * {
                block return 302 "https://$HTTP_HOST$REQUEST_URI"
        }
}

server "__HOSTNAME__" {
  listen on $ext_ip tls port 443
    connection {
# Max body of 5K
      max request body 5120
# Only allow this many requests per persistent connection
        max requests 15
# Timeout the client after N seconds
        request timeout 3
# Timeout the backend after N seconds
        timeout 1
    }

  location "/api/*" {
    fastcgi {
      socket tcp $int_ip 5000
    }
    request strip 1
# No indexing our REST API
      directory no index
  }

  location "/*" {
    root "htdocs/tix.sw.gy"
  }


  tcp {
# Recommended setting
    nodelay
# selective acks
      sack
  }
  tls {
    certificate "/etc/ssl/__HOSTNAME__.fullchain.pem"
      key "/etc/ssl/private/__HOSTNAME__.key"
  }

  location "/.well-known/acme-challenge/*" {
    root "/acme"
      request strip 2
  }
}