What I ended up doing is putting the virtual hosts in SNIProxy on localhost http, and putting NGINX as a HTTPS frontend to it, so that when it recieves a request, it shuttles it to localhost along with the host header.
For posterity, here is my configs:
For SNIProxy:
user nobody
pidfile /run/sniproxy/sniproxy.pid
error_log {
syslog deamon
priority notice
}
listen 127.0.0.1:8000 {
proto http
}
table {
whoogle.* 127.0.0.1:2000
adguard.* 127.0.0.1:2001
bitwarden.* 127.0.0.1:2002
thea.* 127.0.0.1:2003
files.* 127.0.0.1:2004
photopea.* 127.0.0.1:2005
desmos.* 127.0.0.1:2006
youtube.* 127.0.0.1:2007
}
and nginx.conf
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid /dev/null;
daemon off;
events {
worker_connections 1024;
}
http {
proxy_temp_path ./tmp;
access_log /dev/null;
ssl_certificate ./cert.pem;
ssl_certificate_key ./key.pem;
proxy_set_header Host $host;
client_body_temp_path ./tmp;
server {
listen 127.0.0.1:443 ssl;
server_name *.test;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
server {
listen 192.168.1.67:443 ssl;
server_name *.tt;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
server {
listen 127.0.0.1:80;
server_name *.test;
return 302 https://$host$request_uri;
}
server {
listen 192.168.1.67:80;
server_name *.tt;
return 302 https://$host$request_uri;
}
}