如何为两台服务器设置反向代理?

问题描述 投票:0回答:1

我在同一网络上有两台物理服务器,一台邮件服务器和一台视频服务器,两者都需要相同的端口。我用 nginx 解决了这个问题:

        server {
            listen 443 ssl;
            server_name https://mail.mydomain.com;

            ssl_certificate /cert/cert.pem;
            ssl_certificate_key /cert/privkey.pem;

            location / {
                proxy_pass http://https://internalip:443;

            }
        }
        server {
            listen 443;
            server_name https://otherdomain.com;

            location / {
                proxy_pass http://otherserversip:8443;

            }
        }

但我收到此错误:

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

它在我的 /etc/nginx/nginx.conf 文件中

我试图找到另一种方法来做到这一点,但我在任何地方都找不到解决方案。

nginx networking reverse-proxy nginx-reverse-proxy
1个回答
-1
投票

哦,我们刚刚在课堂上学到了这个

© www.soinside.com 2019 - 2024. All rights reserved.