我目前使用的是SNIProxy (这是到目前为止我所看到的最简单的设置虚拟主机的方法)。但是,我只能在每个虚拟主机上分别设置SSL证书和每个服务的配置(每个配置在一个单独的端口上),这很快就会成为一个问题,而不是整个服务器的问题,所以我只需要一个反向代理证书。有办法吗?或者,是否有一个反向代理支持虚拟主机(最好是通配符,以便test.*将转到test.com、test.net、test.org等)并为该代理设置一个TLS证书(我仍然不知道如何在NGINX或Caddy中这样做;NGINX只支持每个文件夹的主机,而Caddy不支持自定义证书,尽管我可能错了)。
发布于 2021-11-17 13:01:47
我最后所做的是将SNIProxy中的虚拟主机放在localhost http上,并将NGINX作为HTTPS前端提供给它,这样当它接收到一个请求时,它会将它与主机头一起传送到本地主机。
为了子孙后代,以下是我的心声:
对于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
}和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;
}
}https://serverfault.com/questions/1083747
复制相似问题