我搜索并发现了许多接近的方案,但我无法让它正常工作。我有 2 台服务器运行多个应用程序。1 台服务器正在运行 nginx 以及其他一些应用程序,另一台服务器正在运行我的 pbx 服务器。我想使用一个域来访问所有这些,但不能使用子域,因为我只想使用一个 SSL 证书。这是我拥有的最新配置。PBX 是问题所在。当我到达位置时https://pbx/pbx它返回私有 IP 地址。
events {
worker_connections 1024;
}
http{
upstream pbx
{
server 192.168.xxx.110;
}
upstream admin
{
server 192.168.xxx.61;
}
server {
listen 443 ssl;
server_name site.net;
error_log /dir/ssl/logs/site.log;
ssl_certificate /site/ssl/site.crt;
ssl_certificate_key /site/private.key;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_protocols TLSv1.1 TLSv1.2;
location /admin {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_pass https://admin/;
proxy_buffering off;
include mime.types;
}
location /pbx{
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_pass https://pbx/;
proxy_set_header Host $host;
proxy_buffering off;
include mime.types;
}
}
}